Microsoft Interview Question
Software DevelopersCountry: United States
Interview Type: In-Person
public static Integer[] removeDuplicates(Integer[] array) {
return new HashSet<Integer>(Arrays.asList(array)).toArray(new Integer[0]);
}
In the first approach, how's it O(N) considering the fact that logarithmic insert is done inside the loop applying to each element?
- GK February 27, 2015