Replace All Pi - doubt

code is working only for n-1 testcases and i cant find any error

correct your while loop
incorrect :- while(n>0)
correct:- while(n>=0)