Doubt in --1 Count

I am able to pass 4 test cases out of 5.I am not able to figure out why i am failing in 1 test case which must be some corner case.pls help me out.
link to my code–https://ide.codingblocks.com/s/77424

when k=0 your code is failing.