Refer for code: -
https://ide.codingblocks.com/s/213582
Only Two test cases are passed
Hello @ambuj_0909,
There are few mistakes in your code:
Refer to comments for better understanding.
Hope, this would help.
Give a like if you are satisfied.
Hi @S18ML0016
Thanks for your help but I tried running your code and it is giving wrong answer for 3 test cases. Could you please modify it so that I could rectify the mistakes I have made in my code.
Hey @ambuj_0909,
This is because i pointed out a mistake by commenting it but forget to comment it:
if(k==-1) should be if(k==0)