Asked inIQVIA,SDE-2

Palindromic Numbers Finder

Given an integer 'N', your task is to identify all palindromic numbers from 1 to 'N'. These are numbers that read the same way forwards and backwards.

Input:

The first line provides a single integer 'T', indicating the number of test cases.

Each test case contains a single integer 'N' located on a new line.

Output:

For each test case, print all palindromic numbers from 1 to 'N' in ascending order, separated by spaces.
Print the results for each test case on a separate line.

Example:

Input:
1
12
Output:
1 2 3 4 5 6 7 8 9 11
Explanation:

Every single-digit number qualifies as a palindrome, and additionally, the number 11 also qualifies as a palindrome.

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 10^9
  • Time Limit: 1 second
Note:

Your solution should not include printing logic, focus on implementing the function logic only.

Be the first one to answer
Add answer anonymously...
IQVIA SDE-2 Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter