80
Description:
Code:
public int removeDuplicates(int[] nums) { int count = 1, repeat = 1; for (int i = 1; i < nums.length; i++) { if (nums[i] == nums[i - 1]) { repeat ++; if (repeat <= 2){ count ++; nums[count-1] = nums[i]; } }else{ count ++; repeat = 1; nums[count-1] = nums[i]; } } return count; }