Thursday, August 21, 2014

COJ 1022. Train Swapping

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.


       FULL SOURCE CODE

No comments:

Post a Comment