标签:rem for code 数组 -- style cat solution bsp
1 class Solution { 2 public int removeDuplicates(int[] nums) { 3 int length = nums.length - 1; 4 for (int i = 0; i <= length; i++) { 5 for (int j = i + 1; j <= length; j++) { 6 if (nums[i] == nums[j]) { 7 for (int k = i; k <length ; k++) { 8 nums[k] = nums[k + 1]; 9 } 10 nums[length] = 0; 11 length--; 12 j--; 13 } 14 } 15 } 16 length++; 17 return length; 18 19 } 20 }
标签:rem for code 数组 -- style cat solution bsp
原文地址:https://www.cnblogs.com/Baronboy/p/10743092.html