[LintCode] Segment Tree Query II

public int query(SegmentTreeNode root, int start, int end) {
        // write your code here
        if(root == null || root.end < start || root.start  > end)
            return 0;
        if(root.start == root.end)
            return root.count;
        return query(root.left, start,end)+ query(root.right, start, end);
    }