@@ -0,0 +1,1606 @@
+/**%0A * Definition of SegmentTreeNode:%0A * public class SegmentTreeNode %7B%0A *     public int start, end, max;%0A *     public SegmentTreeNode left, right;%0A *     public SegmentTreeNode(int start, int end, int max) %7B%0A *         this.start = start;%0A *         this.end = end;%0A *         this.max = max%0A *         this.left = this.right = null;%0A *     %7D%0A * %7D%0A */%0A%0Apublic class Solution %7B%0A    /**%0A     * @param root: The root of segment tree.%0A     * @param start: start value.%0A     * @param end: end value.%0A     * @return: The maximum number in the interval %5Bstart, end%5D%0A     */%0A    public int query(SegmentTreeNode root, int start, int end) %7B%0A        // write your code here%0A        if(start == root.start && root.end == end) %7B // %E7%9B%B8%E7%AD%89 %0A            return root.max;%0A        %7D%0A        %0A        %0A        int mid = (root.start + root.end)/2;%0A        int leftmax = Integer.MIN_VALUE, rightmax = Integer.MIN_VALUE;%0A        // %E5%B7%A6%E5%AD%90%E5%8C%BA%0A        if(start %3C= mid) %7B%0A            if( mid %3C end) %7B // %E5%88%86%E8%A3%82 %0A                leftmax =  query(root.left, start, mid);%0A            %7D else %7B // %E5%8C%85%E5%90%AB %0A                leftmax = query(root.left, start, end);%0A            %7D%0A            // leftmax = query(root.left, start, Math.min(mid,end));%0A        %7D%0A        // %E5%8F%B3%E5%AD%90%E5%8C%BA%0A        if(mid %3C end) %7B // %E5%88%86%E8%A3%82 3%0A            if(start %3C= mid) %7B%0A                rightmax = query(root.right, mid+1, end);%0A            %7D else %7B //  %E5%8C%85%E5%90%AB %0A                rightmax = query(root.right, start, end);%0A            %7D%0A            //rightmax = query(root.right, Math.max(mid+1,start), end);%0A        %7D  %0A        // else %E5%B0%B1%E6%98%AF%E4%B8%8D%E7%9B%B8%E4%BA%A4%0A        return Math.max(leftmax, rightmax);%0A    %7D%0A%7D

add 202