int removeDuplicates(int* nums, int numsSize){ int cnt = 0; for (int i = 0; i<numsSize; i++) if (cnt<2 || nums[i]>nums[cnt - 2]) nums[cnt++] = nums[i]; return cnt; }