Given two values k1 and k2 (where k1 k1, 如果否,则不需要继续向左递归;右子树的处理方法类似 1 public class Solution { 2 /** 3 * @param root: The root of the binary s...
分类:
其他好文 时间:
2015-04-04 06:43:33
阅读次数:
138
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f...
分类:
其他好文 时间:
2015-04-04 06:36:18
阅读次数:
179
Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it.This matrix has the following properties: * ...
分类:
其他好文 时间:
2015-04-02 13:22:41
阅读次数:
113
Given a list of integers, which denote a permutation.Find the previous permutation in ascending order.NoteThe list may contains duplicate integers.Exa...
分类:
其他好文 时间:
2015-04-02 07:55:58
阅读次数:
143
Using O(1) time to check whether an integer n is a power of 2.ExampleFor n=4, return trueFor n=5, return falseChallengeO(1) timeTags Expand 这道题考察bit m...
分类:
其他好文 时间:
2015-04-02 06:39:43
阅读次数:
162
Given an array "nums" of integers and an int "k", Partition the array (i.e move the elements in "nums") such that, * All elements = k are moved to ...
分类:
其他好文 时间:
2015-04-02 06:38:14
阅读次数:
172
1 Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target.2 3 If the ...
分类:
其他好文 时间:
2015-04-02 06:37:00
阅读次数:
120
Find the nth to last element of a singly linked list. The minimum number of nodes in list is n.ExampleGiven a List 3->2->1->5->null and n = 2, return....
分类:
其他好文 时间:
2015-04-02 06:34:52
阅读次数:
101
Given a unsorted array with integers, find the median of it. A median is the middle number of the array after it is sorted. If there are even numbers ...
分类:
其他好文 时间:
2015-03-16 06:14:57
阅读次数:
119
Merge two given sorted integer array A and B into a new sorted integer array.ExampleA=[1,2,3,4]B=[2,4,5,6]return [1,2,2,3,4,4,5,6]ChallengeHow can you...
分类:
其他好文 时间:
2015-03-16 06:11:42
阅读次数:
212