Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

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 7 years ago
1
0
1 2 3 4 5 (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

0 comments

There are no comments, be the first and leave one below:

Similar

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
AS-Level Chemistry: Unit 1:The Atom
Daena Targaryen
GCSE PE
alexis.hobbs99
Flame tests
Joshua Rees