Question https://leetcode.com/problems/next-permutation/
Code
It gives error on sumbmission and I don’t understand what kind of error is it.
Question https://leetcode.com/problems/next-permutation/
Code
It gives error on sumbmission and I don’t understand what kind of error is it.
hello @div_yanshu07
when i will 0 then i-1 will be -1 and accessing negative index will give runtime error.
pls correct this
I have taken care of that. See line no 12.
i m talking about loop in line 3.
just dry runthat loopfor for i=0 and see what u r getting
Handled all the case now it passes sample case but gives run error on submitting
logically ur code was correct , just there were some implementation issues .
check now->