Palindrome numbers

3.5

25 votes
Binary Search, Math Basic, Algorithms, Basic Math, Math
Problem

A palindromic number is a number that remains the same when its digits are reversed. Your task is to get the palindrome number greater than or equal to .

Input format

  • First line: Integer  denoting the number of test cases
  • Each of the following lines:
    •  First line: Two space-separated integers and

Output format

Print lines, each line contains the answer for the case.

Constraints

Sample Input
4
10 23
1 12
5 26
12 11
Sample Output
232
33
212
121
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The first 32 palindrome numbers are:

Editor Image

?