摘要: 如: 1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read ... 阅读全文
posted @ 2019-02-12 22:03 jj千寻 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 如:' hello word is good ',返回:good,4python:class Solution: def strc(self, s): end = len(s) ... 阅读全文
posted @ 2019-02-12 21:35 jj千寻 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 如: a b s,替换:%20%20%20a%20b%20spython:def replaceBlank(str, length): s = '' for i in range(length): ... 阅读全文
posted @ 2019-02-12 21:15 jj千寻 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 如:'abcdzdcab',返回:cdzdc'abcdzdcab111',返回:cdzdcpython:# 1穷举class Solution: def str(self, s): if no... 阅读全文
posted @ 2019-02-12 21:09 jj千寻 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 忽略标点空格大小写,判断字母是否回文:如: A man, a plan, a can al: Panama,return true;python:class Solution: def isPalindr... 阅读全文
posted @ 2019-02-12 20:08 jj千寻 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 如给定:"the sky is blue",返回: "blue is sky the".(多个空格变成一个空格)python:class Solution: def str(self, s): ... 阅读全文
posted @ 2019-02-12 20:03 jj千寻 阅读(88) 评论(0) 推荐(0) 编辑
摘要: python:这里的关键首先是通过collections.defaultdict(int) ,创建默认value是int的字典对象,然后对每一个主串字符统计字母次数;然后对子字符串的每一个字母出现一次就对字典中对... 阅读全文
posted @ 2019-02-12 19:55 jj千寻 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Python:通过collections的Counter类统计字典,转为判断字典是否相等 import collectionsclass Solution: """ @param s: The fir... 阅读全文
posted @ 2019-02-12 19:49 jj千寻 阅读(400) 评论(0) 推荐(0) 编辑
摘要: max(*args, key=None): # 返回最大值max(iterable, *[, default=obj, key=func]) -> valuemax(arg1, arg2, *args, *[, ... 阅读全文
posted @ 2019-02-12 19:45 jj千寻 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 如:给定acdbcdbdse,查询:dbd。返回5Python:class Solution: def strStr(self, source, target): if source is N... 阅读全文
posted @ 2019-02-12 19:29 jj千寻 阅读(118) 评论(0) 推荐(0) 编辑