Its working fine on sample cases

@chemant077,
k can be 1 also.

ok but it shoul pass atleast other cases

still giving wrong output

@chemant077,
Updated code link please…?

https://ide.codingblocks.com/s/202464 its same

@chemant077,
Where are you handling the k=1 case…?? I don’t see it here…

am waiting here for the response

I already replied…Where are you handling the k=1 case…???

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.