812. Find All Palindrome Numbers in a Given Range

Given two integers min and max, return all palindrome numbers in the inclusive range [min, max] in ascending order..

A palindromic number is a number that reads the same forwards and backwards.

Examples: 121, 1221, 9, and 1001 are palindromes.

Example 1:

Input: min = 10, max = 50

Output: [11, 22, 33, 44]

Explanation:

  • Only 11, 22, 33, and 44 in the range [10, 50] are palindromes.

Example 2:

Input: min = 100, max = 150

Output: [101, 111, 121, 131, 141]

Explanation:

  • All these numbers read the same forwards and backwards.

Now Your Turn!

Pick the correct output for the given input

Input: min = 120, max = 135

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= min <= max <= 105
  • Output numbers should be in increasing order
  • No leading zeros are allowed (e.g., 010 is not valid)
0
class Solution {
public:
vector<int> findPalindromes(int minVal, int maxVal) {
// Your code goes here
}
};
 
Test Case

Input:

Max
Min