A palindrome is a word, phrase, number, or other sequence of units that can be read the same way in either direction, with general allowances for adjustments to punctuation and word dividers. For a positive integer P of not more than 1000000 digits, write the value of the smallest palindrome larger than P to output. (Numbers are always displayed without leading zeros.) Ensure that the assignment is submitted with working test cases
The first argument is integer t which is the number of test cases. Followed by t number of positive integers.
For each P, output the smallest palindrome larger than P.
Input
2
809
2136
Output
818 2222
Clone this repo to your local machine using https://github.com/SushantAd/myRepo.git
- java jdk and/or any java ide.
- junit.jar (v4.12)
- hamcrest-core.jar (v1.3)
We can run the code using 2 modes:
Input
2 --> No of test inputs
809
2136
For console inputs:
- javac NextPallindrome.java
- java NextPallindrome
Input
2 --> No of test inputs
809
2136
For test values from File:
- javac NextPalindromeFileInput.java
- java NextPalindromeFileInput
I have used JUnit to run the tests. We can run the testcases using 2 modes:
Run NextPallindromeTest.java
- javac -cp junit-4.12.jar;. NextPallindromeTest.java
- java -cp junit-4.12.jar;hamcrest-core-1.3.jar;. org.junit.runner.JUnitCore NextPallindromeTest
- Leading Zeroes
- Strings and Alpha numeric Values
- Negative Values
- Floating point Values
- Empty spaces in Input values (for console inputs)
- Thanks to stackoverflow for the multiple ideas.


