- 博客(17)
- 资源 (4)
- 收藏
- 关注
原创 leetcode 11.05
链接:https://leetcode.cn/problems/parsing-a-boolean-expression/solution/jie-xi-bu-er-biao-da-shi-by-leetcode-sol-vmvg/商业转载请联系作者获得授权,非商业转载请注明出处。作者:LeetCode-Solution。来源:力扣(LeetCode)
2022-11-05 23:38:57
148
原创 1664 leetcode
class Solution: def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool: return ''.join(word1) == ''.join(word2)
2022-11-01 23:16:43
147
原创 leetcode 907
MOD = 10 ** 9 + 7class Solution: def sumSubarrayMins(self, arr: List[int]) -> int: n = len(arr) monoStack = [] left = [0] * n right = [0] * n for i, x in enumerate(arr): while monoStack and x
2022-10-28 23:20:52
177
原创 598. 范围求和 II
class Solution: def maxCount(self, m: int, n: int, ops: List[List[int]]) -> int: mina, minb = m, n for a, b in ops: mina = min(mina, a) minb = min(minb, b) return mina * minb
2021-11-07 19:31:06
62
原创 367. 有效的完全平方数
class Solution: def isPerfectSquare(self, num: int) -> bool: l, r = 1, num//2+1 while l <= r: mid = (l+r)//2 square = mid*mid if square == num: return True elif squa.
2021-11-05 02:18:44
75
原创 407. 接雨水 II
class Solution: def trapRainWater(self, heightMap: List[List[int]]) -> int: if len(heightMap) <= 2 or len(heightMap[0]) <= 2: return 0 m, n = len(heightMap), len(heightMap[0]) visited = [[0 for _ in range(.
2021-11-03 22:20:31
73
原创 237. 删除链表中的节点
class Solution: def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """ node.val, node.next = node.next.val, node.next.next
2021-11-02 23:01:25
74
原创 Leetcode 575. 分糖果
class Solution: def distributeCandies(self, candyType: List[int]) -> int: candyType.sort() n = len(candyType)/2 result = 0 pre = None for a in candyType: if result >= n: break .
2021-11-01 19:26:25
67
原创 Leetcode 500. 键盘行
简单题class Solution: def findWords(self, words: List[str]) -> List[str]: dests = ["qwertyuiop","asdfghjkl","zxcvbnm"] result = [] for word in words: f = -1 flag = True for w in word:
2021-10-31 21:26:22
102
原创 LeetCode 335
from typing import Listclass Solution: def isSelfCrossing(self, distance: List[int]) -> bool: # 逆时针,只需要记录前面三个点,没次运动都跟前面三个点做比较 # a: if len(distance) <= 3: return False # 一开始走三步 # 保存前6步参数 ..
2021-10-29 21:50:35
98
原创 LeetCode 868. 重新排序得到 2 的幂
解题思路:1:获取n数字的长度下所有2的幂的数字(例如3,则获取2,4,8)2:获取步骤1中每个数字的0-9的数量,并组合成字符串,添加到集合list中3:获取数字n每个数字的0-9的数量,并组合成字符串判断是否存在于list中即可classSolution:defreorderedPowerOf2(self,n:int)->bool:ifn==0:returnFalse#数字n的...
2021-10-28 17:57:21
2757
原创 2021-10-27
LeetCode每日一题301. 删除无效的括号解题思路:回溯+剪枝算法执行用时:2260 ms, 在所有Python3提交中击败了9.08%的用户内存消耗:15.2 MB, 在所有Python3提交中击败了54.07%的用户
2021-10-27 10:39:22
219
RSA算法加解密java工具
2020-02-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人