1 /** 2 * Definition for binary tree 3 * public
class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 *
TreeNo...
分类:
其他好文 时间:
2014-05-05 22:44:13
阅读次数:
328
1 /** 2 * Definition for binary tree 3 * public
class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 *
TreeNo...
分类:
其他好文 时间:
2014-05-05 22:43:14
阅读次数:
313
Link:http://oj.leetcode.com/problems/balanced-binary-tree/Given a binary tree,
determine if it is height-balanced.For this problem, a height-balanced ...
分类:
其他好文 时间:
2014-05-05 22:29:55
阅读次数:
382
题目:
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new len...
分类:
其他好文 时间:
2014-05-05 12:58:57
阅读次数:
294
关于permutation的讲解,请参见http://blog.csdn.net/xuqingict/article/details/24840183
下列题目的讲解均是基于上面的文章:
题1:
Next Permutation
Total Accepted: 8066 Total
Submissions: 32493My Submissions
...
分类:
其他好文 时间:
2014-05-04 00:01:36
阅读次数:
343
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-03 23:21:20
阅读次数:
292
题目:
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (c...
分类:
其他好文 时间:
2014-05-03 21:48:19
阅读次数:
252
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an...
分类:
其他好文 时间:
2014-05-03 21:35:49
阅读次数:
310
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points...
分类:
其他好文 时间:
2014-05-03 17:35:30
阅读次数:
345
Given a set of distinct integers, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.
For exa...
分类:
其他好文 时间:
2014-05-03 15:47:53
阅读次数:
289