Domanda di colloquio di Morgan Stanley

Onsite #7 Remove duplicates from a sorted array with O(1) space

Risposta di colloquio

Anonimo

12 nov 2018

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