# For every element starting from index 1, if it is not equal to the previous unique element, we write it to index k and increment k.