Ad
  • Default User Avatar

    Ahh, you mean every person swaps with the person who has the same index from the other side of the queue (with respect to the 1's and 3's). that's not really clear at first, I thought we would swap everyone with the last person in the line.

  • Default User Avatar

    I don't understand why do we swap even after the queue had been sorted, and what is the algorithm that we use to swap after sorted?

  • Default User Avatar

    Well, I've been able to get the index of the digit we want in the corresponding element, like if (n) is 9.
    then I know that its index is 3 in the 4th element, and the number of digits of the element is 4.
    Am I going the right way? (C++)

  • Default User Avatar

    Yeah, you're correct. After adding new line after each test case, it really isn't.

  • Default User Avatar

    Didn't he say "All numbers are equal except for one"? then why there are some test cases that has multiple values?