this is the code i’ve written. This gives correct answers but isn’t passing test cases. Please, comment where is the error.
Correct answer test cases failing
Is your code giving TLE or wrong answer on submission?
It shows wrong answer.
Change line 17 to p[1] =0; and then check
You can refer this code https://ide.codingblocks.com/s/286969
Found the mistake. I had taken the input values of a and b twice!
Thanks btw.