题目描述: 方法一:O(N) class Solution: def findNumbers(self, nums: List[int]) -> int: ans=0 for num in nums: if len(str(num))%2==0: ans+=1 return ans 方法二:数学 O ...
分类:
其他好文 时间:
2019-12-25 20:43:12
阅读次数:
85
题目描述: 自己的提交: class Solution: def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int: c = collections.Counter() for i in range(l ...
分类:
其他好文 时间:
2019-12-25 17:47:39
阅读次数:
137
题目描述: 方法一:排序O(Nlogn) class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: intervals.sort(key = lambda x:(x[0],-x[1])) ...
分类:
其他好文 时间:
2019-12-23 17:07:09
阅读次数:
54
题目描述: 方法一:二分法 class Solution: def findSpecialInteger(self, arr: List[int]) -> int: span = len(arr)//4 + 1 for i in range(0,len(arr),span): a = bisect. ...
分类:
编程语言 时间:
2019-12-23 17:06:53
阅读次数:
85
题目描述: 方法: class CombinationIterator: def __init__(self, characters: str, combinationLength: int): self.s = characters self.pos = [x for x in range(com ...
分类:
其他好文 时间:
2019-12-23 16:39:02
阅读次数:
81
1.子串的最大出现次数 给你一个字符串 s ,请你返回满足以下条件且出现次数最大的 任意 子串的出现次数: 子串中不同字母的数目必须小于等于 maxLetters 。子串的长度必须大于等于 minSize 且小于等于 maxSize 。 示例 1: 输入:s = "aababcaab", maxLe ...
分类:
其他好文 时间:
2019-12-22 14:26:54
阅读次数:
68
LeetCode 第 166 场周赛 "1281.subtract the product and sum of digits of an integer" "1282.group the people given the group size they belong to" "1283.find ...
分类:
其他好文 时间:
2019-12-10 13:14:12
阅读次数:
141
题目描述: 自己的提交: class Solution: def tictactoe(self, moves: List[List[int]]) -> str: p = [[0] * 3 for _ in range(3)] if len(moves) < 5: return "Pending" f ...
分类:
其他好文 时间:
2019-12-02 19:11:51
阅读次数:
70
题目描述: 自己的提交: class Solution: def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> List[int]: t = (tomatoSlices - 2 * cheeseSlices) / 2 c = ...
分类:
其他好文 时间:
2019-12-02 18:55:17
阅读次数:
78
题目描述: 自己的提交:动态规划 class Solution: def deleteTreeNodes(self, nodes: int, parent: List[int], value: List[int]) -> int: dp = [[0, 0]for _ in range(nodes)] ...
分类:
其他好文 时间:
2019-12-02 13:34:02
阅读次数:
114