Reverse Base36 Number
Updated
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) → longExamples
Example 1
n = 100return = 1010100 in base 36 is 2S. Reversing gives S2, which is 28 * 36 + 2 = 1010.
Example 2
n = 36return = 136 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.