Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:
其他好文 时间:
2015-05-16 23:08:32
阅读次数:
161
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
其他好文 时间:
2015-05-16 23:06:06
阅读次数:
148
题目:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 ...
分类:
其他好文 时间:
2015-05-16 17:57:57
阅读次数:
107
I would recommend that people not be so focused on a career. They should go to college to have new experiences and learn about themselves and the worl...
分类:
其他好文 时间:
2015-05-16 17:48:52
阅读次数:
99
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 followin...
分类:
编程语言 时间:
2015-05-15 21:05:11
阅读次数:
176
题目描述:Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Yo...
分类:
编程语言 时间:
2015-05-15 19:48:35
阅读次数:
159
This is my 1st 3D DP problem, and it should be an educational one. But, still tricky to me.Here is a good article:http://www.cnblogs.com/sunshineatnoo...
分类:
其他好文 时间:
2015-05-15 17:14:33
阅读次数:
114
接着第一节中的第一个示例,我们扩展第二个示例,将词法分析程序扩展为识别不同的词性。
下面是程序示例:%{
/*
* 扩展第一个示例以识别其他的词性
*
*/
%}
%%
[ ]+ /* 忽略空白 */;
is |
am |
are |
were |
was |
be |
being |
been |
do |
does |
did |
will |
would |
should |...
分类:
其他好文 时间:
2015-05-15 09:15:10
阅读次数:
119
描述:
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
For example, given the range [5, 7], you should return 4.
思路:
由于相邻的两个数最低位肯定有0有1,所以直接and肯定为0,所以可以通过直接and来和向右移位获得一个区间内的相同的位数,最后再通过向左...
分类:
其他好文 时间:
2015-05-15 09:03:20
阅读次数:
104
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 target, where in...
分类:
其他好文 时间:
2015-05-14 10:09:29
阅读次数:
131