Flashcards
Remove Duplicates from Sorted Array
Cards in this deck (1)
- 1Remove Duplicates from Sorted Arrayclass Solution {
public int removeDuplicates(int[] nums) {
if(nums == null) return 0;
int j = 1;
for(int i = 1; i< nums.length ;++i){
if(nums[i] != nums[i-1]) nums[j++] = nums[i];
}
return j;
}
}
Information
- Description
- Flashcards on Remove Duplicates from Sorted Array, created by Suhas S on 15/02/2018.
- Created by
- Suhas S
- Views
- 7
- Tags
- Rating