Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
编程语言 时间:
2014-10-27 08:10:18
阅读次数:
196
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total numb...
分类:
其他好文 时间:
2014-10-26 17:04:00
阅读次数:
194
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2014-10-26 16:58:18
阅读次数:
134
【题目】
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 digit. Add the two numbers and return it...
分类:
其他好文 时间:
2014-10-26 14:21:29
阅读次数:
243
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
其他好文 时间:
2014-10-26 11:35:14
阅读次数:
142
题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is...
分类:
其他好文 时间:
2014-10-25 22:56:10
阅读次数:
164
n!=x*b^y,
当x为正整数时,最大的y就是n!末尾0的个数了,
把n,b分别拆成素因子相乘的形式:
例如,
n=5,b=16
n=5,b=2^4,
很明显,末尾0的个数为0
10进制时,n!=a*10^x
b进制时,n!=c*b^y
很明显,n!的位数就是最大的x+1
这里计算我用了log,精度设置为1e-9
#include...
分类:
其他好文 时间:
2014-10-24 20:47:09
阅读次数:
320
题目描述:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
思路:先判断给的数是正数还是负数还是零。如果是零,则直接返回。如果是正数,则通过%和/运算求得给定数字的各位,再重新组合得到要求得数字。如果为负数则先转换为正数,再按正数处理,最后返回...
分类:
其他好文 时间:
2014-10-24 16:42:21
阅读次数:
112
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-10-23 22:15:45
阅读次数:
130
Problem Description
Mr. B writes an addition equation such as 123+321=444 on the blackboard after class. Mr. G removes some of the digits and makes it look like “1?3+??1=44?”. Here “?” denotes remo...
分类:
其他好文 时间:
2014-10-22 01:05:25
阅读次数:
213