LeetCode第7题: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environm ...
分类:
编程语言 时间:
2018-05-18 20:12:39
阅读次数:
259
题目:数组加一 难度:Easy 题目内容: Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that ...
分类:
编程语言 时间:
2018-05-18 14:22:47
阅读次数:
217
题目描述: X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be ...
分类:
其他好文 时间:
2018-05-17 00:55:06
阅读次数:
166
随机密码定向生成加盐直接复制importstringimportrandomcount=8str_from=string.ascii_letters+string.digits"".join([random.choice(str_from)for_inrange(count)])‘NLlZXbh9‘importstringimportrandomdefrandom_passwd(count):"生
分类:
其他好文 时间:
2018-05-12 00:06:20
阅读次数:
160
利用map和reduce编写一个str2float函数,把字符串'123.456'转换成浮点数123.456: DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} def ...
分类:
其他好文 时间:
2018-05-11 13:48:01
阅读次数:
235
题目 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 whi ...
分类:
其他好文 时间:
2018-05-08 22:26:37
阅读次数:
180
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and ...
分类:
编程语言 时间:
2018-05-01 23:47:27
阅读次数:
350
[抄题]: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is ...
分类:
其他好文 时间:
2018-05-01 17:47:28
阅读次数:
127
Given a non negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat ...
分类:
其他好文 时间:
2018-04-29 22:17:27
阅读次数:
262
question: try: result: re-try: result: conclusion: 效率很低,n2. 看讨论区里的posts,发现主要问题在于对于n和n+1,我的方法是重新计算n+1是否good,浪费。如果使用dp,可以利用n是否good这个结论,从而降低复杂度。 讨论区里面还有一 ...
分类:
其他好文 时间:
2018-04-29 13:32:45
阅读次数:
131