Remove Duplicates from Sorted Array

Description

Flashcards on Remove Duplicates from Sorted Array, created by Suhas S on 15/02/2018.
Suhas S
Flashcards by Suhas S, updated more than 1 year ago
Suhas S
Created by Suhas S over 6 years ago
0
0

Resource summary

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; } }
Show full summary Hide full summary

Similar

PHP Exam One
tr.badhan
Array Programs
Subash M
Array
alim586
Array
Tate Johnson
Test Card
Nick Wu
Given an array of integers, rotate the array by 'N' elements.
Suhas S
Single sell stock
Suhas S
Spanish Questions
Niat Habtemariam
General Pathoanatomy Final MCQs (401-519)- 3rd Year- PMU
Med Student
Anatomie - sistemul respirator 1
Eugeniu Nicolenco