For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decre ...
分类:
其他好文 时间:
2019-08-17 18:00:35
阅读次数:
1440
import string string.punctuation 会返回所有常用的标点符号 string.ascii_letters 会返回 a-zA-Z string.ascii_lowercase 小写a-z string.ascii_uppercase 大写A-Z string.digits ...
分类:
其他好文 时间:
2019-08-13 15:05:58
阅读次数:
98
problem:https://leetcode.com/problems/remove-k-digits 单调栈。维护一个递增的栈,每pop一次意味着移除了一个元素,k--。减为0时不再移除。前导0处理起来很麻烦,很容易WA。 ...
分类:
其他好文 时间:
2019-08-10 17:46:13
阅读次数:
83
题目: https://leetcode-cn.com/problems/plus-one/ 如果digits数组最后一位小于9,则只需要将digits数组最后一个数+1,返回digits数组即可;如果最后一位等于9,则需要设置一个循环进行加法模拟,即对每一位进行判断,小于10退出循环,如果等于10 ...
分类:
编程语言 时间:
2019-08-09 13:41:45
阅读次数:
77
A cryptarithmetic puzzle is a mathematical game where the digits of some numbers are represented by letters. Each letter represents a unique digit. Fo ...
分类:
其他好文 时间:
2019-08-06 11:01:04
阅读次数:
98
请参考以下网址中的表格:https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts The most common superscript digits (1, 2, and 3) were in ISO-8859-1 and ...
1 //检验一个大数是否能3整除 2 //A number is divisible by 3 if sum of its digits is divisible by 3. 3 //we cannot use n % 3 to check if a number is divisible by 3... ...
分类:
其他好文 时间:
2019-08-03 21:58:36
阅读次数:
130
A. Digits Sequence Dividing 注意特殊情况,在$n = 2$时除非$str[1] = str[2]$,否则可以把第一个数划分下来,剩下的数直接当成一组,一定满足条件。 C. Brutality 用堆维护连续子段最大和即可。 D. Compression 实质上是把这图压缩到 ...
分类:
其他好文 时间:
2019-08-03 00:15:44
阅读次数:
86
66. Plus One 1. 题目 Given a non empty array of digits representing a non negative integer, plus one to the integer. The digits are stored such that the ...
分类:
其他好文 时间:
2019-08-02 09:13:09
阅读次数:
86
http://codeforces.com/contest/489/problem/C 大数就是从最高位,能大就大;小数就是从最低位,能小就小,再处理下最高位为0的情况。 无结果无非一个sum太小,min全为0,一个sum太大,全为9还有剩 ...
分类:
其他好文 时间:
2019-07-27 23:55:02
阅读次数:
185