Problem Statement
A positive integer is called a palindrome if it reads the same forward and backward. Integers containing leading zeros are not valid. For example, 12321 is a palindrome, but 123210 is not. You are given an int K. Return the K-th palindrome, where the 0th palindrome is 1, the 1st palindrome is 2, etc.
Definition
- Class:
- IntegerPalindrome
- Method:
- findByIndex
- Parameters:
- int
- Returns:
- long
- Method signature:
- long findByIndex(int K)
- (be sure your method is public)
Constraints
- K will be between 0 and 1000000000 (109), inclusive
Examples
8
Returns: 9
9
Returns: 11
19
Returns: 111
235
Returns: 13731
23746
Returns: 137484731