Code failing 1 test case

for input 0 the code mentioned in the video will not work.