Sum Root to Leaf Numbers
Total Accepted: 20237 Total
Submissions: 67979My Submissions
Given a binary tree containing digits from 0-9 only,
each root-to-leaf path could represent a numbe...
分类:
其他好文 时间:
2014-09-05 16:12:01
阅读次数:
200
题目链接:HDU 1058 Humble Numbers
题意:一些数他们的素数因子只有2,3,5,7。求这些数。
因为这些数的因子只可能是2,3,5,7。所以通过2,3,5,7这个四个数构造这个数列,这个数列靠后的数必定是前面的数乘上2,3,5,7得到。
AC代码:
#include
#include
#define ll __int64
using namesp...
分类:
其他好文 时间:
2014-09-05 14:26:41
阅读次数:
103
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-09-05 12:36:41
阅读次数:
227
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-09-05 05:31:40
阅读次数:
176
LeetCode: CombinationsGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solu...
分类:
其他好文 时间:
2014-09-04 22:03:20
阅读次数:
221
比较水的动态规划
dp[i][j] 将原串 i ~ j 之内的字符转化为回文字符所需要的最小操作次数
其中删除操作和添加操作本质上是一样的。
三个状态转移方程:
dp[i][j] = min(dp[i][j] ,dp[i + 1][j]);
dp[i][j] = min(dp[i][j] ,dp[i + 1][j - 1]);
dp[i][j] = min(dp[i][j] ,dp...
分类:
其他好文 时间:
2014-09-04 19:05:40
阅读次数:
189
1 #include 2 3 void main() 4 { 5 int a[10] = {0}; 6 int i,j,t; 7 printf("input 10 numbers:\n"); 8 for (i = 0; i a[i+1]) {16 ...
分类:
其他好文 时间:
2014-09-04 18:32:49
阅读次数:
203
传入函数的参数可以简单的用一个数组动态传入 func?sumOf(numbers:?Int...)?->?Int?{
????var?sum?=?0
????for?number?in?numbers?{
????????sum?+=?number
????}
????ret...
分类:
编程语言 时间:
2014-09-04 17:15:10
阅读次数:
276
MedianTime Limit: 5 Seconds Memory Limit: 65536 KBThe median of m numbers is after sorting them in order, the middle one number of them if m is even o...
分类:
其他好文 时间:
2014-09-04 16:49:29
阅读次数:
190
PalindromesA regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a pali....
分类:
其他好文 时间:
2014-09-04 00:01:57
阅读次数:
310