If we look deeper we will understand that no matter how we do the swaps the answer is not going to be different ( of course if we do swaps only when one is bigger than the one standing next to him). The rest is easy, we need to loop over and swap if there is a need until there will be no more swappings left.
No comments:
Post a Comment