The Short Address
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
A URL shortener turns each new link's sequential row id into a compact slug. Encode a non-negative integer `n` into base 62 over the alphabet '0' through '9', then 'a' through 'z', then 'A' through 'Z', with the most significant digit first. The id `0` maps to the slug '0', not an empty string.
Summary
Every link needs a slug small enough to type by hand.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.