JOIN
Get Time

   Problem Statement  

 Problem Statement for NextPalindromicNumber

Problem Statement

    

A palindromic number is a number that reads the same forward and backward. 101, 4 and 6666 are palindromic numbers while 10, 564 and 15452 are not.

You will be given a String n representing a positive integer. Determine the smallest palindromic integer strictly greater than n, and return it as a String with no leading zeroes.

 

Definition

    
Class:NextPalindromicNumber
Method:getNext
Parameters:String
Returns:String
Method signature:String getNext(String n)
(be sure your method is public)
    
 

Notes

-No positive multiple of 10 is a palindromic number.
 

Constraints

-n will contain between 1 and 50 characters, inclusive.
-Each character of n will be a digit ('0'-'9').
-The first character of n will not be zero ('0').
 

Examples

0)
    
"12345"
Returns: "12421"
1)
    
"858"
Returns: "868"
2)
    
"1999"
Returns: "2002"
3)
    
"1"
Returns: "2"
4)
    
"9999"
Returns: "10001"

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 330 Round 1 - Division II, Level Three