4.3 Given a sorted (increasing order) array with unique integer elements, write an algorithm to create a binary search tree with minimal height.这道题给了我...
分类:
其他好文 时间:
2015-08-01 01:03:53
阅读次数:
118
4.2 Given a directed graph, design an algorithm to find out whether there is a route between two nodes.LeetCode和CareerCup中关于图的题都不是很多,LeetCode中只有三道,分别是...
分类:
其他好文 时间:
2015-07-31 01:12:47
阅读次数:
199
4.1 Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that t...
分类:
其他好文 时间:
2015-07-29 13:46:49
阅读次数:
99
3.6 Write a program to sort a stack in ascending order (with biggest items on top). You may use at most one additional stack to hold items, but you ma...
分类:
编程语言 时间:
2015-07-27 07:04:04
阅读次数:
162
3.5 Implement a MyQueue class which implements a queue using two stacks.LeetCode上的原题,请参见我之前的博客Implement Queue using Stacks 用栈来实现队列。
分类:
其他好文 时间:
2015-07-27 01:47:23
阅读次数:
108
3.4 In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide onto any tower. The puzzle starts ...
分类:
其他好文 时间:
2015-07-26 12:25:22
阅读次数:
122
3.3 Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when ...
分类:
其他好文 时间:
2015-07-26 08:35:16
阅读次数:
122
3.1 Describe how you could use a single array to implement three stacks.这道题让我们用一个数组来实现三个栈,书上给了两种方法,第一种方法是定长分割 Fixed Division,就是每个栈的长度相同,用一个公用的一位数组buff...
分类:
编程语言 时间:
2015-07-25 13:47:15
阅读次数:
107
3.2 How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min shou...
分类:
其他好文 时间:
2015-07-25 13:46:14
阅读次数:
120
2.7 Implement a function to check if a linked list is a palindrome.LeetCode上的原题,参见我之前的博客Palindrome Linked List 回文链表。
分类:
其他好文 时间:
2015-07-22 22:22:58
阅读次数:
108