码迷,mamicode.com
首页 >  
搜索关键字:maximum number of th    ( 33896个结果
leetcode题目:Sum Root to Leaf Numbers和Longest Consecutive Sequence
题目一: 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
c语言快速判断一个数是偶数还是奇数
#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
LeetCode: N-Queens II [051]
【题目】 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
LeetCode:3Sum Closest
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
LeetCode: Maximum Subarray [052]
【题目】 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
LeetCode: Jump Game [054]
【题目】 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
每日算法之十五:threesumClosset
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及多个返回值得获取
当 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
C经典之14-双向链表存储1-10---ShinePans
#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
ProjectEuler 003题
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!