摘要: class Solution { public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList<>(); Arrays.sort(nums); // 先对数组排序,便于使用双指 阅读全文
posted @ 2025-05-22 21:59 星星永远发着光 阅读(6) 评论(0) 推荐(0)
摘要: class Solution { // 移动零到数组末尾,同时保持非零元素的原有顺序 public void moveZeroes(int[] nums) { int n = nums.length; // 数组长度 int left = 0, right = 0; // 双指针:left指向待替换 阅读全文
posted @ 2025-05-22 16:11 星星永远发着光 阅读(9) 评论(0) 推荐(0)