标签:class code dup rem solution ica size 数组 cto
1 class Solution { 2 public: 3 int removeDuplicates(vector<int>& nums) { 4 if(nums.empty()) 5 return 0; 6 int i = 0; 7 for(int j = 1; j < nums.size(); j++) 8 { 9 if(nums[i] != nums[j]) 10 { 11 i++; 12 nums[i] = nums[j]; 13 } 14 } 15 return i + 1; 16 } 17 };
标签:class code dup rem solution ica size 数组 cto
原文地址:https://www.cnblogs.com/cccv/p/9210728.html