摘要: LeetCode刷题记录——day10 1、https://leetcode.cn/problems/rotate-image/description/?envType=study-plan-v2&envId=2024-spring-sprint-100 class Solution { public: void rotate(vecto 阅读全文
posted @ 2024-04-08 09:16 想成为编程高手的阿曼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day9 https://leetcode.cn/problems/game-of-life/?envType=study-plan-v2&envId=2024-spring-sprint-100 先创建一个数组,让它比原数组大一圈,然后将其全设为0,在原数组中每有一个1出现,就将其对应位置的新数组的周围全部 阅读全文
posted @ 2024-03-31 15:23 想成为编程高手的阿曼 阅读(3) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day8 https://leetcode.cn/problems/spiral-matrix/description/?envType=study-plan-v2&envId=2024-spring-sprint-100 注意每次改变边界都有判断一次 class Solution { public: vec 阅读全文
posted @ 2024-03-29 23:04 想成为编程高手的阿曼 阅读(3) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day7 1、https://leetcode.cn/problems/reverse-words-in-a-string/description/?envType=study-plan-v2&envId=top-interview-150 class Solution { public: string re 阅读全文
posted @ 2024-03-27 19:21 想成为编程高手的阿曼 阅读(1) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day6 1、https://leetcode.cn/problems/length-of-last-word/description/?envType=study-plan-v2&envId=top-interview-150 直接从后往前遍历就好 class Solution { public: int 阅读全文
posted @ 2024-03-24 18:27 想成为编程高手的阿曼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、https://leetcode.cn/problems/roman-to-integer/solutions/1/bao-li-po-jie-by-a-studentdog-s1va/?envType=study-plan-v2&envId=top-interview-150 关键在于创建字典 阅读全文
posted @ 2024-03-23 20:41 想成为编程高手的阿曼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/trapping-rain-water/description/?envType=study-plan-v2&envId=top-interview-150 对于一个可以构成“碗”的序列,最后装满水的话应该和最短的一边齐平,那么可以左右各遍历 阅读全文
posted @ 2024-03-22 22:35 想成为编程高手的阿曼 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1、https://leetcode.cn/problems/gas-station/submissions/514930619/?envType=study-plan-v2&envId=top-interview-150 对于这个问题可以这样来考虑,将数据看作一个环,如果答案唯一,那么就意味着从任 阅读全文
posted @ 2024-03-21 20:28 想成为编程高手的阿曼 阅读(17) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day2 https://leetcode.cn/problems/product-of-array-except-self/description/?envType=study-plan-v2&envId=top-interview-150 问题在于不使用除法并且空间复杂度为O(1),当第一次从头开始遍历时 阅读全文
posted @ 2024-03-20 20:28 想成为编程高手的阿曼 阅读(17) 评论(0) 推荐(0) 编辑
摘要: LeetCode刷题记录——day1 https://leetcode.cn/problems/h-index/description/?envType=study-plan-v2&envId=top-interview-150 注:题目有点难理解,多读几遍 可以这样考虑,建立另一个临时数组temp,当第i篇文章被引用citiation 阅读全文
posted @ 2024-03-18 20:28 想成为编程高手的阿曼 阅读(22) 评论(0) 推荐(0) 编辑