026.Remove Duplicates from Sorted Array Posted on 2017-09-16 | In LeetCode Test cases12345[][0, 2][2, 2][1, 1, 2][0, 1, 2] Solution 1: accepted 13ms1234567891011121314public int removeDuplicates(int[] nums) { int len = nums.length; if (nums.length < 2) return len; int count = 1; for (int i = 1; i < len; i++) { if (nums[i - 1] != nums[i]) { nums[count] = nums[i]; count++; } } return count;}