Problem

Reverse Base36 Number

ZopsmartOA

You are given a non-negative decimal integer n.

Convert n to its uppercase base-36 representation. Reverse that base-36 string, then interpret 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.

Examples
01 · Example 1
n = 100
return = 1010

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

02 · Example 2
n = 36
return = 1

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

Constraints
  • n is a non-negative decimal integer.
  • The returned value fits in a 64-bit signed integer.
More Zopsmart problems
drafts saved locally
public long reverseBase36Number(long n) {
  // write your code here
}
n100
expected1010
sign in to submit