Reverse Number Problem Statement

Ninja is exploring new challenges and desires to reverse a given number. Your task is to assist Ninja in reversing the number provided.

Note:

If a number has trailing zeros, they should be omitted in its reversed form. For instance, the reverse of 10400 will be 401 instead of 00401.

Input:

The first line contains an integer 'T' indicating the number of test cases.
Each test case consists of a single line containing an integer 'N', the specified number.

Output:

For each test case, print the reversed number.
Output each result on a new line.

Constraints:

  • 1 <= T <= 5
  • 1 <= N <= 1018
  • Time Limit = 1 sec

Note:

No need to handle input or output display. Your task is to implement the function to find the reverse only.

AnswerBot
1mo

Implement a function to reverse a given number, omitting trailing zeros.

  • Create a function that takes an integer as input and reverses it while omitting trailing zeros

  • Use string manipulation to reverse...read more

Help your peers!
Add answer anonymously...
Accenture Software Developer 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