Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all ...
分类:
其他好文 时间:
2014-10-12 19:12:18
阅读次数:
158
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers....
分类:
其他好文 时间:
2014-10-12 18:25:38
阅读次数:
195
/**在有顺序的数组中插入一个元素后该数列仍然是有顺序的数组:思路:先找到该元素的插入位置 插入数据时要先将数组中得元素后移,然后插入该元素*/#include #define n 10int main(){ // 在有顺序的数列中插入一个元素后该数列仍然是有顺序的数列: int a[n] ...
分类:
编程语言 时间:
2014-10-12 17:47:58
阅读次数:
177
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle...
分类:
其他好文 时间:
2014-10-12 16:58:58
阅读次数:
248
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:
其他好文 时间:
2014-10-12 16:41:38
阅读次数:
185
9 单例模式(确保自己使用的资源都是全局的) 1)普通单体(字面量初始化对象) var?person?=?{
name?:?‘zhangsan‘,
age?:?12,
getAge?:?function(){
return?this.age?;
}
}
person.height?=?185?;...
分类:
编程语言 时间:
2014-10-12 16:22:08
阅读次数:
265
Sqrt(x)
Total Accepted: 26074 Total
Submissions: 116517My Submissions
Implement int sqrt(int x).
Compute and return the square root of x.
题意:实现求方根 sqrt(x)
思路:二分法
对于一个数,它的方...
分类:
其他好文 时间:
2014-10-12 16:05:18
阅读次数:
160
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-...
分类:
其他好文 时间:
2014-10-12 15:51:58
阅读次数:
190
N-QueensThen-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all...
分类:
其他好文 时间:
2014-10-12 15:11:58
阅读次数:
263
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
/**
* Definition for s...
分类:
其他好文 时间:
2014-10-12 13:59:18
阅读次数:
182