I submitted these two solutions and one got AC and one got WA. These two solution only vary in line 53 .
if (n < r || r < 0 || n < 0) return 0;
If the solution was wrong because of this line , why didn’t it give Runtime error and WA , as then either of the value would have tried to access a negative index .
Thanks in advance.