Reported December 2025
Zopsmartmath

Reverse Base36 Number

Reported by candidates from Zopsmart's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Zopsmart OA. Under 2s to a working solution.
Founder's read

Zopsmart reported this one in December 2025, and it looks harmless until you read the constraint. n goes up to 10^12, so you can't loop up to n or build anything proportional to its value. The trick is that base-36 digits of 10^12 number about eight, so the work is tiny. Convert, reverse, reinterpret. If your head goes blank on the digit math the night of the OA, StealthCoder runs invisibly as a safety net and hands you the clean version. Still, this is a ten-minute problem if you see the digit loop.

The problem

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.
Note: if the reversed string has leading zeros, they are ignored when interpreting the reversed string as a base-36 number (e.g., "01" is interpreted as 1).

Function
reverseBase36Number(n: long) → long

Examples
Example 1
n = 100
return = 1010
100 in base 36 is 2S. Reversing gives S2, which is 28 * 36 + 2 = 1010.
Example 2
n = 36
return = 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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is plain digit extraction, which is why the hint says two-pointers. You peel digits off n with n % 36 and n / 36. Those come out least significant first, which is already the reversed order. So you don't need a string at all. Start with result = 0, and for each digit d do result = result * 36 + d. That builds the reversed number directly, and leading zeros vanish on their own. Check example 2: 36 gives digits 0 then 1, so result goes 0, then 1. Correct. Pitfalls: use a 64-bit type, handle n = 0 by returning 0, and don't mix up letter values if you go the string route. The guarantee that the answer fits in 64 bits means no overflow guard. If you blank mid-assessment, StealthCoder is the hedge that reads the prompt and gives you this loop.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Reverse Base36 Number cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Zopsmart's OA.

Zopsmart reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Reverse Base36 Number FAQ

How hard is the Zopsmart Reverse Base36 Number question really?+

Easy. The input is at most 10^12, so base 36 gives about eight digits. There's no clever algorithm, just careful conversion. Most of the risk is edge cases like n = 0 and leading zeros after the reverse, not the logic itself.

What's the trick to solving it without strings?+

Extract digits with n % 36 and n / 36. They arrive least significant first, which is the reversed order already. Fold them in with result = result * 36 + digit. No string building, no reversing, and leading zeros disappear automatically.

Do I need to worry about overflow?+

Use a 64-bit integer, like long. The problem guarantees the returned value fits in a signed 64-bit integer, so you don't need extra guards. Just don't use a 32-bit int for n, since 10^12 exceeds it.

What edge cases should I test?+

Test n = 0, which should return 0. Test 36, which reverses to 01 and returns 1. Test 100, which should return 1010. Also try a number whose base-36 form is a palindrome, since the output should equal the input.

How do I prepare for this in 48 hours?+

Practice base conversion both ways: decimal to base b by repeated mod and divide, and base b back to decimal by multiply and add. Write it once with strings and once without. Once you can do both from memory, this problem is trivial.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Zopsmart.

OA at Zopsmart?
Invisible during screen share
Get it