6.5 There is a building of 100 floors. If an egg drops from the Nth floor or above, it will break. If it's dropped from any floor below, it will not b...
分类:
其他好文 时间:
2015-08-27 12:42:20
阅读次数:
125
5.7 An array A contains all the integers from 0 to n, except for one number which is missing. In this problem, we cannot access an entire integer in A...
分类:
其他好文 时间:
2015-08-21 13:13:09
阅读次数:
205
5.6 Write a program to swap odd and even bits in an integer with as few instructions as possible (e.g., bit 0 and bit 1 are swapped, bit 2 and bit 3 a...
分类:
其他好文 时间:
2015-08-20 07:58:25
阅读次数:
111
5.2 Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot be represent...
分类:
其他好文 时间:
2015-08-11 15:57:26
阅读次数:
122
5.1 You are given two 32-bit numbers, N and M, and two bit positions, land j. Write a method to insert M into N such that M starts at bit j and ends a...
分类:
其他好文 时间:
2015-08-10 09:25:49
阅读次数:
110
4.9 You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum to a given value. The path does ...
分类:
其他好文 时间:
2015-08-09 10:40:51
阅读次数:
122
4.8 You have two very large binary trees: Tl, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree...
分类:
其他好文 时间:
2015-08-08 12:01:40
阅读次数:
103
4.6 Write an algorithm to find the'next'node (i.e., in-order successor) of a given node in a binary search tree. You may assume that each node has a l...
分类:
其他好文 时间:
2015-08-07 00:10:52
阅读次数:
112
4.5 Implement a function to check if a binary tree is a binary search tree.LeetCode上的原理,请参见我之前的博客Validate Binary Search Tree 验证二叉搜索树。
分类:
其他好文 时间:
2015-08-04 00:37:06
阅读次数:
97
4.4 Given a binary tree, design an algorithm which creates a linked list of all the nodes at each depth (e.g., if you have a tree with depth D, you'll...
分类:
其他好文 时间:
2015-08-02 00:55:41
阅读次数:
137