题目: 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- ...
分类:
其他好文 时间:
2017-05-13 16:54:50
阅读次数:
164
题目: 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 ...
分类:
其他好文 时间:
2017-05-13 16:06:11
阅读次数:
167
题目: 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 / ...
分类:
其他好文 时间:
2017-05-13 16:01:29
阅读次数:
153
题目: 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-> ...
分类:
其他好文 时间:
2017-05-13 12:33:08
阅读次数:
124
题目: 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 ...
分类:
其他好文 时间:
2017-05-13 12:21:24
阅读次数:
208
题目: 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, ...
分类:
其他好文 时间:
2017-05-13 11:10:13
阅读次数:
155
题目: 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 ...
分类:
其他好文 时间:
2017-05-13 10:01:56
阅读次数:
122
题目: Given a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value ...
分类:
其他好文 时间:
2017-05-10 20:36:32
阅读次数:
185
题目: Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all the keys of tree in range k1 to k2. i.e. print all ...
分类:
其他好文 时间:
2017-05-10 13:13:49
阅读次数:
136
题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Example Given binary tree {3 ...
分类:
其他好文 时间:
2017-05-09 23:14:37
阅读次数:
188