Reverse a number

Beginner Problems Basic Maths Easy

You are given an integer n. Return the integer formed by placing the digits of n in reverse order.

Examples:

Input: n = 25

Output: 52

Explanation: Reverse of 25 is 52.

Input: n = 123

Output: 321

Explanation: Reverse of 123 is 321.

Input: n = 54

Constraints

  • 0 <= n <= 5000
  • n will contain no leading zeroes except when it is 0 itself.

Company Tags

TCS Cognizant Accenture Infosys Capgemini Wipro IBM HCL Tech Mahindra MindTree