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.
Input: 2 808 2133 Output: 818 2222
Warning: large Input/Output data, be careful with certain languages
I solved it using rust <3
Why is the implementation difficulty so high? I found it to be pretty easy in both concept and implementation in CPP14
If you're getting SIGABRT then it means that you're probably converting the given string to int so you must not do that. You must solve the problem in the string itself as the input is too large.
I got right answers for sample and custom test case. But still i am getting WA.
10^6 digits not 10^6 int...
For me, the problem with wrong answers was caused by leading zeros or spaces in input values. So assume that you must sanitize input first.
my code is running successfully in cmd prompt but judge is not accepting it, it is showing wrong answer. what could be the reason behind it.
I got it but it's exceding time limit, I wrote 19 lines of code :(
|Cluster:||Cube (Intel G860)|
|Languages:||All except: NODEJS PERL6|