Need help in Dictionary Orer-Larger

Hello, I require help in the problem Recursion-Dictionary Order(Larger). Here’s my code ->


Its giving WA in Case 2.

Hello @saurabhpandey59373,

  1. There is no need of swapping it back

  2. The logic of your code is correct.
    But, storing strings in set is changing the order of input:
    Input:
    231
    expected Output:
    321
    312
    your Output:
    312
    321

Modification:

Hope, this would help.

Thnx sir, I got it now.

Anytime.:blush:

Please, mark this doubt as resolved.