Getting wrong answer in the problem code:PERMUT2

I am taking about your orig. It has n digits. And an int can only have 9 digits. So when n > 10, you have overflow in orig.

Add this optimization flag to detects overflows.

3 Likes