摘要:
Q:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of the nodes in each of the two partitions.For example,Given1->4->3->2->5->2andx= 3,return1->2->2->4-> 阅读全文
摘要:
Q:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].A: 先按interval的start排序,后顺序扫描进行merge vector merge(vector &intervals) { // Start typing your C/C++ solution below // DO NOT write int main() functio... 阅读全文