[LintCode] Segment Tree Query
public int query(SegmentTreeNode root, int start, int end) { // write your code here if(root == null || root.start > end || root.end < start) return 0; if(root.start == root.end) return root.max; return Math.max(query(root.left,start,end),query(root.right,start,end)); }
Leave A Comment