Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 472 Bytes

Largest Palindrome.md

File metadata and controls

28 lines (19 loc) · 472 Bytes

Find the largest palindrome made from the product of two 3-digit numbers which is less than N .

Input Format

First line contains T that denotes the number of test cases. This is followed by T lines, each containing an integer,N .

Output Format

Print the required answer for each test case.

CONSTRAINTS

1≤ T ≤ 100

101101≤ N ≤ 1000000

Sample Input

2
101110
800000

Sample Output

101101
793397