从这里看到的,没看到好的solution. 大家讨论一下?
* 把一个字符串转换成32bit的整数
* 一个range的序列(链表或数组),如[1,3], [2,6], [8,10],[15,18]
写程序合并有重叠的range,比如上面的序列合并为[1,6], [8,10], [15,18]
如果这个序列不是静态的,而是一个数据流,如何 处理?
Ppl mentioned interval tree, but I do not think it would work here.
* implement the merge of two int arrays A and B, using the similar way as
merge-sort
Further question:
if A's size is over the max possible value of the int array, how do u
handlethat? suppose you have enough memory (do some math here, e.g. 2^ 30, 2
^ 40.... headache)