Leetcode in Java && Oracle
420 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
#N26 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;
}
}