Practice

3-Digit Palindrome Filter

2022/May/June·Variant 1
MEDIUMLoops

Write an algorithm that takes an integer Limit as input. It then loops Limit times, reading an integer Value each time. If Value is a 3-digit number (between 100 and 999 inclusive) and its first digit equals its last digit, output that number.

Input: Integer Limit, followed by Limit integers. Output: Each qualifying number on a new line.

Example:

Input:  4
        99
        606
        8448
        747
Output: 606
        747
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Mixed digits and lengths
Inputs: 4, 99, 606, 8448, 747
Expected: 606 747
Test 2: Standard 3-digit checks
Inputs: 3, 121, 500, 343
Expected: 121 343