Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2014-07-06 13:57:54
阅读次数:
155
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:
其他好文 时间:
2014-07-06 13:32:49
阅读次数:
204
把一个排好序的vector转换为一颗二分查找树。很简单的题目,递归即可,保证边界不要出错。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; ...
分类:
其他好文 时间:
2014-07-06 12:53:50
阅读次数:
174
Power Strings
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 31093
Accepted: 12974
Description
Given two strings a and b we define a*b to be their concate...
分类:
其他好文 时间:
2014-07-06 00:33:22
阅读次数:
253
For the exercises in this chapter we need a list of English words. There are lots of word lists available on the Web, but the most suitable for our pu...
分类:
其他好文 时间:
2014-07-05 22:45:55
阅读次数:
545
Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].题目的意思是将相交得区间合并...
分类:
其他好文 时间:
2014-07-05 22:24:49
阅读次数:
177
Given two integers n and k, return all possible combinations of k numbers out of 1 ...n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4...
分类:
其他好文 时间:
2014-07-05 22:10:53
阅读次数:
226
Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially...
分类:
其他好文 时间:
2014-07-05 21:45:00
阅读次数:
202
Description: Given two strings, write a method to decide if one is a permutation of the other.We could use the same idea from CTCI 1.1. The only diffe...
分类:
其他好文 时间:
2014-07-05 21:43:01
阅读次数:
231
记录学习点滴,菜鸟成长记归并排序的英文叫做Merge-Sort,要想明白归并排序算法,还要从“递归”的概念谈起。1.递归一般来讲,人在做决策行事的时候是往往是从已知出发,比如,我又要举个不恰当的例子了→_→:看到漂亮姑娘→喜欢人家→追→女朋友→老婆但是人家施瓦辛格不是这么想的,人家从小就立志当总统:...
分类:
其他好文 时间:
2014-07-05 21:32:47
阅读次数:
220