Morgan Stanley Interview Question: Onsite #7 Remove duplicates f... | Glassdoor

Interview Question

Java Developer Interview New York, NY

Onsite #7 Remove duplicates from a sorted array with O

 (1) space
Answer

Interview Answer

1 Answer

0

Array is sorted that is the key here, We need a variable to hold current insert position in an array. Start iterate over an array and compare current and next elements. when they are not matching put it at insert position and then increment insert position and keep iterating over an array

Interview Candidate on Nov 11, 2018

Add Answers or Comments

To comment on this, Sign In or Sign Up.