【题目】
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 5 unique BST's shown below.
1 ...
分类:
其他好文 时间:
2014-12-27 16:11:53
阅读次数:
109
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should do...
分类:
其他好文 时间:
2014-12-27 06:43:00
阅读次数:
359
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.代码:oj在...
分类:
编程语言 时间:
2014-12-26 16:08:31
阅读次数:
205
题目:Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list a...
分类:
编程语言 时间:
2014-12-26 14:27:01
阅读次数:
205
题目描述:
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8,...
分类:
其他好文 时间:
2014-12-26 13:03:53
阅读次数:
169
In order to reuse the Fragment UI components, you should build each as a completely self-contained, modular component that defines its own layout and behavior. Once you have defined these reusable Fra...
分类:
其他好文 时间:
2014-12-26 09:45:18
阅读次数:
210
题目:
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without ...
分类:
其他好文 时间:
2014-12-25 23:43:28
阅读次数:
450
题目:
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the ta...
分类:
编程语言 时间:
2014-12-25 23:41:10
阅读次数:
255
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of...
分类:
其他好文 时间:
2014-12-25 22:10:27
阅读次数:
180
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes
of the first two lists.
题目意思为合并两个链表,不能用额外的空间(新链由两个链拼接而成)
思路:
比较简单,直接定义两个指针,分别...
分类:
其他好文 时间:
2014-12-25 22:09:16
阅读次数:
186