# Leetcode 150 Interview ## [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/?envType=study-plan-v2&envId=top-interview-150) ## Deductions - The input array is sorted in an ascending order. - The duplicate elements need to be pushed to the back of the array, preferably by swapping, because the solution has to be in place. - The ordering of the repeated elements does not matter. - Numbers can be said to be existing in adjacent colonies, colonies of 0s, followed by colonies of 1s and so on, each colony comprises of either a single number or more. ## High Level Approach - In the end we would want a divider, to the left of which we have only unique elements in an ascending order, to the right would be all the elemts in any-order. - The divider would move only to the right, in a single pass, thus solving the problem with a proposed complexity of O(n) - We can imagine a scenario where, where at any intermediate stage, our input array is divided into three parts, the first part carries all unique numbers in ascending order, the second part contains the repeated numbers and the third part contains numbers that haven't been processed yet. For 3 sections we need 2 pointers to act as dividers.