Tap here to switch tabs
Problem
Submissions

Problem: Mirror Distance of an Integer

med
30 min
Try to solve the Mirror Distance of an Integer problem.

Statement

Given an integer n, return its mirror distance.

The mirror distance of an integer n is defined as the absolute difference between n and the integer obtained by reversing the decimal digits of n. Any leading zeros resulting from the digit reversal are ignored when interpreting the reversed number.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Mirror Distance of an Integer

med
30 min
Try to solve the Mirror Distance of an Integer problem.

Statement

Given an integer n, return its mirror distance.

The mirror distance of an integer n is defined as the absolute difference between n and the integer obtained by reversing the decimal digits of n. Any leading zeros resulting from the digit reversal are ignored when interpreting the reversed number.

Constraints:

  • 1≤1 \leq n ≤109\leq 10^9