G****A 发帖数: 4160 | 1 貌似一道老题,记得有人讨论过。
Given a sorted linked list. Each node is an interval consisting of two
integers. Implement a function to insert a given interval into the list and
maintain the order. Be careful about all possible cases.
e.g., List: (1,5), (9, 12), (21, 24). Given interval (10, 23)
--> newList: (1,5), (9, 24) | t*********n 发帖数: 89 | 2 keyword: leetcode, insert interval.
不过这个是把array 换成了 linkedlist而已。
六种case. 细心一点就行。 |
|