Sum square difference
Problem 6
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ....
分类:
其他好文 时间:
2014-05-23 02:22:57
阅读次数:
193
Smallest multiple
Problem 5
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly di...
分类:
其他好文 时间:
2014-05-23 01:51:13
阅读次数:
261
Given a sorted linked list, delete all nodes
that have duplicate numbers, leaving onlydistinctnumbers from the original
list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-05-21 17:51:09
阅读次数:
190
在Heat中完全使用aws的语法创建一套autoscaling的template。
流程:
Create LaunchConfig (Create basic instance, send mem status to ALARM) ->
Create ASGroup (Define instance num range) ->
Create ScaleUpPolicy (+1 in...
分类:
其他好文 时间:
2014-05-21 16:01:10
阅读次数:
315
【题目】
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
Note:
All numbers (including target) will be ...
分类:
其他好文 时间:
2014-05-21 15:55:25
阅读次数:
259
【题目】
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) w...
分类:
其他好文 时间:
2014-05-21 15:21:28
阅读次数:
292
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【题意】
给定用字符串表示的整数,返回两个数的乘积结果字符串。两个数字都非负,且能任意大。
【思路】
1. 考虑其中一个数是0的情况
2. 模拟乘法运算...
分类:
其他好文 时间:
2014-05-21 13:45:37
阅读次数:
214
最近编写Python程序时经常遇见中文相关的问题,这里说一个问题的解决方法。
我在使用json模块的dumps()函数时,因为涉及到中文,报出如下错误:
ascii codec can't decode byte 0xe8 in position 0:ordinal not in range(128)
这是编码相关的问题,在该程序中加入如下代码:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
这样就可以解决该问题了,希望对大家有所帮助。...
分类:
编程语言 时间:
2014-05-21 09:47:21
阅读次数:
323
UVA 10712 - Count the Numbers
题目链接
题意:求区间[A,B]数字中,子串包含N的数字有多少个
思路:数位DP,写了个记忆化乱搞搞过了,dp[i][j][2][2][2],分别表示i位的时候,末尾为j的情况,后面3维用来处理小于的情况,已经出现过子串的情况,前导0的情况,然后注意特判一下数字0的情况,因为一开始要分解数字,而0是不能分解的。
代...
分类:
其他好文 时间:
2014-05-21 09:11:44
阅读次数:
264
题目:
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 t...
分类:
其他好文 时间:
2014-05-21 07:42:18
阅读次数:
230