哦,target是个区间啊 sort and merge. Then use binary search check. 其实time complexity 是一样的, space complexity还更好 O(n)。我总觉得segment tree 没什么用。有没有哪道题需要 用segment tree? A segment tree for a set I of n intervals uses O(n log n) storage and can be built in O(n log n) time
【在 c********t 的大作中提到】 : 哦,target是个区间啊 : sort and merge. Then use binary search check. 其实time complexity 是一样的, : space complexity还更好 O(n)。我总觉得segment tree 没什么用。有没有哪道题需要 : 用segment tree? : A segment tree for a set I of n intervals uses O(n log n) storage and can be : built in O(n log n) time