LeetCode26-删除有序数组中的重复项 LeetCode26-删除有序数组中的重复项12345678910public int removeDuplicates(int[] nums) { int n = nums.length; int j = 0; for (int i = 0; i < n; i++) { if (nums[i] != nums[j]) { nums[++j] = nums[i]; } } return j + 1; } LeetCode 力扣 计算机基础 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! LeetCode28-实现strStr() Previous LeetCode21-合并两个有序链表 Next Please enable JavaScript to view the comments