Forwarded from Leetcode in Java && Oracle
#N26 Remove Duplicates from Sorted Array
problem link=>https://leetcode.com/problems/remove-duplicates-from-sorted-array/
problem link=>https://leetcode.com/problems/remove-duplicates-from-sorted-array/
class Solution {
public int removeDuplicates(int[] nums) {
int i = 0;
for (int n : nums)
if (i == 0 || n > nums[i-1])
nums[i++] = n;
return i;
}
}