题目一:
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Fin...
分类:
其他好文 时间:
2014-05-26 04:06:41
阅读次数:
248
#include
int main()
{
int a;
while(1)
{
printf("please input the number:\n");
scanf("%d",&a);
if(a&1)
{
printf("%d是奇数\n",a);
}
else
{
printf("%d是偶数\n",a);
}
}
return 0;
}这...
分类:
编程语言 时间:
2014-05-26 03:36:15
阅读次数:
367
【题目】
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
【题意】
解N皇后问题,N-Queens要求返回所有的解,而本题只需要返回可行解的数目
【思路】
DFS,参考N-Queens...
分类:
其他好文 时间:
2014-05-25 01:51:55
阅读次数:
236
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. You may assume that each input would have
exact...
分类:
其他好文 时间:
2014-05-25 00:46:51
阅读次数:
229
【题目】
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] has the largest sum = 6.
【题意】
给定一个数组,找出和最大的子数组,返回...
分类:
其他好文 时间:
2014-05-24 22:19:17
阅读次数:
260
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:...
分类:
其他好文 时间:
2014-05-24 20:44:39
阅读次数:
221
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. You may assume
that each input would have exact...
分类:
其他好文 时间:
2014-05-24 20:43:37
阅读次数:
341
当 Lua 调用 C 函数的时候,使用和 C 调用 Lua 相同类型的栈来交互。C 函数从栈中获取她的参数,调用结束后将返回结果放到栈中。为了区分返回结果和栈中的其他的值,每个 C 函数还会返回结果的个数(the function returns (in C) the number of results it is leaving on the stack.)。
// lua...
分类:
编程语言 时间:
2014-05-24 19:37:41
阅读次数:
372
#include
#include
#include //system(); 这个指令需要用到此头文件
#include //toupper要用到
#include //在内存管理时用到的头文件
void main()
{
int i;
struct ListEntry{
int number; //数据域
struct ListEntry *next; //指向 下...
分类:
其他好文 时间:
2014-05-24 18:15:27
阅读次数:
258
1 //题目:The prime factors of 13195 are 5, 7, 13 and
29.2 //What is the largest prime factor of the number 600851475143 ? 1 #include
2 using namespace s...
分类:
其他好文 时间:
2014-05-24 10:01:21
阅读次数:
222