PALIN - The Next Palindrome
A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros.
The first line contains integer t, the number of test cases. Integers K are given in the next t lines.
For each K, output the smallest palindrome larger than K.
Warning: large Input/Output data, be careful with certain languages
Finally accepted after 2 WA! check for tricky cases:
In this problem, it is expected that a single-digit number is NOT a palindrome. So, when you get a single-digit number as an input, the output should be 11.
Wth! Working everytime in my compiler but says wrong output here.... What's going on?
Be careful while comparing.
hey , Is 1000 a palindrome ?
If you use recursion you will get NZEC (in python at least)
Can anyone tell me how to rectify NZEC runtime
I'm unable to get the output to thi question.
This is a great problem! I'm a beginner (this is my 10th day learning programing from nothing). It took me many tries but finally got accepted(c#). Tips for beginners like myself (POSSIBLE SPOILER ALERT):
time limit exceeded :( But it takes only 0.2 secs in ideone