The idea it to basically not have repeated values in the array with similar values.
An example input array:
input = [1,2,2,2,2,3,4,5,6,7,8,9] Expected output to be something like this:
desiredOutput = [1,2,3,2,4,2,5,2,6,2,7,8,9] I have tried putting this in a for loop where it checks with the next item and if it is same, swaps the values. The problem is when I have continuous similar values.
[9,2,3,1,4,2,5,2,6,2,7,8,2]