Question | Answer |
Remove Duplicates from Sorted Array | class 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; } } |
Want to create your own Flashcards for free with GoConqr? Learn more.