I am getting wrong answer for the problem : https://www.spoj.com/problems/JNEXT/ My solution is: https://ideone.com/asbWID Can anyone help me to figure it out?
Try these
2 3 1 3 2 4 1 6 5 4