09 2023 档案

摘要:链接 https://leetcode.cn/problems/teemo-attacking/description/ 思路 这题思路其实很简单,需要2个变量,1个记住总数,1个记住之前遍历过的序列能够访问到的最大值。 如果遍历到某个数时,这个最大值比他大,就证明之前序列中的某个加和被浪费掉了,所 阅读全文
posted @ 2023-09-18 19:17 BJFU-VTH 阅读(4) 评论(0) 推荐(0) 编辑
摘要:链接: https://leetcode.cn/problems/max-consecutive-ones/description/ 思路: 没啥好说的吧.....基础题目 代码 class Solution: def findMaxConsecutiveOnes(self, nums: List[ 阅读全文
posted @ 2023-09-06 09:55 BJFU-VTH 阅读(1) 评论(0) 推荐(0) 编辑
摘要:链接 https://leetcode.cn/problems/license-key-formatting/description/ 思路 字符串处理,没啥好说的... 代码 class Solution: def licenseKeyFormatting(self, s: str, k: int 阅读全文
posted @ 2023-09-06 09:43 BJFU-VTH 阅读(3) 评论(0) 推荐(0) 编辑
摘要:链接 https://leetcode.cn/problems/number-complement/description/ 思路 没啥好说的,二进制与十进制的互相转换,基本功。 代码 class Solution: def findComplement(self, num: int) -> int 阅读全文
posted @ 2023-09-04 13:48 BJFU-VTH 阅读(6) 评论(0) 推荐(0) 编辑
摘要:链接 https://leetcode.cn/problems/island-perimeter/description/ 思路 这题理论上来讲可以用深搜广搜来做,但我第一时间没搞明白怎么做,所以就先迭代一发。 思路就是: 1. 题目给定的只有1个岛屿,那么我们可以遍历整个grid,对于发现的新岛屿 阅读全文
posted @ 2023-09-04 13:40 BJFU-VTH 阅读(5) 评论(0) 推荐(0) 编辑