Solved RemoveDuplicatesFromSortedArray in java