WELCOME TO Pluto134340小行星

清风湿润,茶烟轻扬。
摘要: 165. 比较版本号 split("\\.") Integer.parseInt(); 长度不够 为空就用0填充!!! public int compareVersion(String version1, String version2) { String[] v1 = version1.split 阅读全文
posted @ 2026-03-27 11:01 Pluto134340 阅读(3) 评论(0) 推荐(0)
摘要: 142. 环形链表 II 注意!!! 无环返回null public ListNode detectCycle(ListNode head) { Set<ListNode> set = new HashSet<>(); ListNode cur = head; while(cur!=null){ i 阅读全文
posted @ 2026-03-27 10:31 Pluto134340 阅读(2) 评论(0) 推荐(0)
摘要: 82. 删除排序链表中的重复元素 II 注意用 cur.next 判断,值重复 cur.next = cur.next.next; 跳过当前重复节点 public ListNode deleteDuplicates(ListNode head) { ListNode dummy = new List 阅读全文
posted @ 2026-03-27 10:21 Pluto134340 阅读(3) 评论(0) 推荐(0)
摘要: 25. K 个一组翻转链表 画图做!!! pre head tail dummy 1 2 3 4 5 cur tail找到要反转的长度,cur尾插法逐个从头到后加入tail后面 class Solution { public ListNode reverseKGroup(ListNode head, 阅读全文
posted @ 2026-02-24 12:34 Pluto134340 阅读(4) 评论(0) 推荐(0)
摘要: LCR 022. 环形链表 II set 或者快慢指针 快慢指针需要注意!!! fast 和 slow相遇地方不一定是环入口,需要重新遍历找到环入口 if(slow==fast){ ListNode tmp = head; while(tmp!=slow){ tmp=tmp.next; slow=s 阅读全文
posted @ 2026-02-23 16:09 Pluto134340 阅读(4) 评论(0) 推荐(0)
摘要: 73. 矩阵置零 注意定义!!! List<int[]> map = new ArrayList<>(); map.get(i) 54. 螺旋矩阵 记思路 向左向右向前看~ 注意每次for()后要判断是否越界 48. 旋转图像 记思路 先上下反转,再对角线对称 240. 搜索二维矩阵 II if(t 阅读全文
posted @ 2026-02-22 17:08 Pluto134340 阅读(2) 评论(0) 推荐(0)
摘要: LCR 017. 最小覆盖子串 不会!!!背诵 回去看吧 53. 最大子数组和 拿下拿下 sum记录当前总和最大值 max记录全局最大值 LCR 074. 合并区间 思路对了,细节容易出错 记录待对比数组tmp,比较当前数组左边在不在tmp中,在改变右边界max(right,tmp[1]) 不在则不 阅读全文
posted @ 2026-02-21 16:49 Pluto134340 阅读(6) 评论(0) 推荐(0)
摘要: LCR 016. 无重复字符的最长子串 map存窗口内元素和下标,不会因为窗口大幅度移动逐个改变map值,所以需要 left = Math.max(left, map.get(ch)+1); 动态维护左边界,动态更新map中值 class Solution { public int lengthOf 阅读全文
posted @ 2026-02-20 14:13 Pluto134340 阅读(4) 评论(0) 推荐(0)
摘要: 283. 移动零 思路: 两个指针 i 和 pre ,pre指向0元素,i 往后遍历找到距离pre 最近的一个非0元素,然后进行交换,pre++ class Solution { public void moveZeroes(int[] nums) { int n = nums.length; in 阅读全文
posted @ 2026-02-19 14:45 Pluto134340 阅读(4) 评论(0) 推荐(0)
摘要: 1. 两数之和 暴力枚举 i 0~n; j i+1~n 哈希map 存值和 id LCR 033. 字母异位词分组 排序后转字符串作为key存入哈希map,list再存入str 错误写法:array.toString() → 返回数组内存地址,无法作为有效键。 ——>String key = new 阅读全文
posted @ 2026-02-19 10:10 Pluto134340 阅读(3) 评论(0) 推荐(0)