FastPrepReverse Base36 Number
Problems/Reverse Base36 Number

Reverse Base36 Number

ZopSmart logoZopSmartOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given a non-negative decimal integer n.

Write n in base-36 using uppercase letters. Reverse that base-36 string. Then read the reversed string as a base-36 number and return its decimal value.

In base 36, digits 0 through 9 have values 0 through 9, and letters A through Z have values 10 through 35.

If the reversed string starts with zeros, ignore them when you read it as a base-36 number. For example, "01" is read as 1.

Function

reverseBase36Number(n: long) → long

Examples

Example 1

n = 100return = 1010

100 in base 36 is 2S. Reversing gives S2, which is 28 * 36 + 2 = 1010.

Example 2

n = 36return = 1

36 in base 36 is 10. Reversing gives 01, whose decimal value is 1.

Constraints

  • 0 <= n <= 1012
  • The returned value fits in a 64-bit signed integer.

More ZopSmart Online Assessment questions

  • Base36 Square RootOA · Seen Dec 2025
  • Minimum Hidden Roman ValueOA · Seen Dec 2025
See ZopSmart hiring insights
Saved
class Solution {
    public long reverseBase36Number(long n) {
      // write your code here
    }
}
Checking account…