摘要: 题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Example 2 1->2->3 => / \ 1 3 2 1->2- 阅读全文
posted @ 2017-05-13 15:53 Vincent丶丶 阅读(194) 评论(0) 推荐(0)
摘要: 题目: Given a sorted (increasing order) array, Convert it to create a binary tree with minimal height. Example Given [1,2,3,4,5,6,7], return 4 / \ 2 6 / 阅读全文
posted @ 2017-05-13 15:26 Vincent丶丶 阅读(209) 评论(0) 推荐(0)
摘要: 题目: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep 阅读全文
posted @ 2017-05-13 15:15 Vincent丶丶 阅读(253) 评论(0) 推荐(0)
摘要: 题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example Given lists: [ 2->4->null, null, -1->nu 阅读全文
posted @ 2017-05-13 14:10 Vincent丶丶 阅读(248) 评论(0) 推荐(0)
摘要: 题目: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Example Given -21->10->4->5, tail connects to node 阅读全文
posted @ 2017-05-13 11:09 Vincent丶丶 阅读(203) 评论(0) 推荐(0)
摘要: 题目: Given a linked list, determine if it has a cycle in it. Example Given -21->10->4->5, tail connects to node index 1, return true Given -21->10->4-> 阅读全文
posted @ 2017-05-13 10:59 Vincent丶丶 阅读(117) 评论(0) 推荐(0)
摘要: 题目: Given a singly linked list L: L0 → L1 → … → Ln-1 → Ln reorder it to: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → … Example Given 1->2->3->4->null, reorder i 阅读全文
posted @ 2017-05-13 10:47 Vincent丶丶 阅读(218) 评论(0) 推荐(0)
摘要: 题目: Sort a linked list in O(n log n) time using constant space complexity. Example Given 1->3->2->null, sort it to 1->2->3->null. Given 1->3->2->null, 阅读全文
posted @ 2017-05-13 09:53 Vincent丶丶 阅读(189) 评论(0) 推荐(0)
摘要: 题目: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve 阅读全文
posted @ 2017-05-13 08:40 Vincent丶丶 阅读(155) 评论(0) 推荐(0)
摘要: 题目: Reverse a linked list from position m to n. Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. Example Given 1->2->3->4->5->N 阅读全文
posted @ 2017-05-13 08:18 Vincent丶丶 阅读(156) 评论(0) 推荐(0)