You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-28 10:45:34
阅读次数:
225
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 nu...
分类:
其他好文 时间:
2014-06-26 00:29:49
阅读次数:
168
水题就要水的滴水不漏=-=,第一个疗程博主决定按照SPOJ提交人数的顺序开始刷,主要任务在于熟悉Python. 42. Adding Reversed Numbers 题目非常简单Sample input: 324 14358 754305 794 第一行是下面输入的行数,主要说的事儿是把第一个数反...
分类:
编程语言 时间:
2014-06-25 22:44:11
阅读次数:
250
UVA 10539 - Almost Prime Numbers
题目链接
题意:给定一个区间,求这个区间中的Almost prime number,Almost prime number的定义为:只能整除一个素数。
思路:既然是只能整除一个素数,那么这些数肯定为素数的x次方(x > 1),那么只要先打出素数表,然后在素数表上暴力找一遍就可以了,因为素数表只要找到sqrt(Max...
分类:
其他好文 时间:
2014-06-25 20:10:16
阅读次数:
181
题目链接:uva 10712 - Count the Numbers
题目大意:给出n,a,b;问说在a到b之间有多少个n。
解题思路:数位dp,dp[i][j][x][y]表示第i位为j的时候,x是否前面是相等的,y是否已经出现过n。对于n=0的情况要特殊处理前导0,写的非常乱,搓死。
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-06-24 22:22:07
阅读次数:
391
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-06-24 18:56:54
阅读次数:
240
Given a string, determine if it is a palindrome, considering only alphanumeric
characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" i...
分类:
其他好文 时间:
2014-06-24 18:16:02
阅读次数:
147
【题目】
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a palindrome.
Note:
Have you consider that the string m...
分类:
其他好文 时间:
2014-06-24 15:35:07
阅读次数:
150
Description
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) i...
分类:
其他好文 时间:
2014-06-22 17:15:11
阅读次数:
275
题目:
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.
Find...
分类:
其他好文 时间:
2014-06-22 08:30:24
阅读次数:
236