码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
Checkio: Roman numerals
题目: Roman numerals come from the ancient Roman numbering system. They are based on specific letters of the alphabet which are combined to signify the sum (or, in some cases, the difference) of th...
分类:其他好文   时间:2014-06-20 12:27:09    阅读次数:394
Euler Project 1 -- 鸽巢原理
题目要求 1000 内可以被 3 或者 5 整除的数字之和 可以很简单地这么写: print sum( [ i for i in xrange( 1000 ) if i % 3 == 0 or i % 5 == 0 ] ) 但是对于10^10的数据,要运行很长时间,可以利用一点鸽巢原理 10^10中能被 3 整除的数据和加上能被 5 整除的数据和减去能被 15 整除的数据和即可,求...
分类:其他好文   时间:2014-06-20 11:46:19    阅读次数:249
LeetCode: Path Sum II [113]
【题目】 Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 ...
分类:其他好文   时间:2014-06-20 10:53:08    阅读次数:181
projecteuler---->problem=20----Factorial digit sum
n! means n (n 1) ... 3 2 1 For example, 10! = 10 9 ... 3 2 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits...
分类:其他好文   时间:2014-06-20 09:34:10    阅读次数:215
Path Sum
题目 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary t...
分类:其他好文   时间:2014-06-07 15:31:32    阅读次数:179
LeetCode: Path Sum [112]
【题目】 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum = 22, 5 / ...
分类:其他好文   时间:2014-06-07 13:57:37    阅读次数:210
Path Sum II
题目 Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 ...
分类:其他好文   时间:2014-06-07 13:47:22    阅读次数:191
projecteuler---->problem=18----Maximum path sum I
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find th...
分类:其他好文   时间:2014-06-07 13:45:25    阅读次数:189
projecteuler---->problem=21----Amicable numbers
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b...
分类:其他好文   时间:2014-06-07 13:40:53    阅读次数:226
leetcode--Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".public class Solution { /**The program is us...
分类:其他好文   时间:2014-06-05 14:08:35    阅读次数:188
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!