Ad
  • Custom User Avatar

    in the future, please do not use the issue tag to ask for help and use markdown to post your code
    (see there).

    Debug your code. I added this line to your code, and this is what I see for n = 56789:

    std::cout << temp << " --> ";
    
    56789 --> 95678 --> 89567 --> 78956 --> 67895 --> 56789
    

    whereas the proper rotations of 56789 as shown in the description are:

    56789 -> 67895 -> 68957 -> 68579 -> 68597
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution