According to me all cases are working fine in my solution of finding the next palindrome greater than k. Can anyone help in finding the error i may have done. Thanks.
Check the cases again. For input 1212 your code prints 1331 but the correct output is 1221.
For finding more wrong cases yourself, you can make use of simple bruteforce algorithm for the problem and check its outputs against that of your original algorithm for small inputs 1-1000000 to find cases for which your original optimized algorithm gives wrong answer.
Hope it helps!
Thanks a lot!!! Yes i will try more hard with my test cases.