Please try to explain the requirements better. "[29917, 1, 0] could be a solution too but index i in [29917, 1, 0] is greater than
index i in [29917, 0, 1]." could be replaced by "Among multiple solutions resulting in the same number, the solution with the smallest index i is preferred." Which would improve clarity a LOT
In c++ I passed the test cases, then I tried the 'attempt' and I passed the random tests too but then failed the same test cases I previously passed. Definitely something wrong here
This comment is hidden because it contains spoiler information about the solution
Please try to explain the requirements better. "[29917, 1, 0] could be a solution too but index i in [29917, 1, 0] is greater than
index i in [29917, 0, 1]." could be replaced by "Among multiple solutions resulting in the same number, the solution with the smallest index i is preferred." Which would improve clarity a LOT
In c++ I passed the test cases, then I tried the 'attempt' and I passed the random tests too but then failed the same test cases I previously passed. Definitely something wrong here
1
Perhaps pushing and popping a space would be easier to understand and avoid a second call to std::reverse