Loading...

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
mid, senior

Problem

Implement the encoding half of a URL shortener. Given a non-negative integer, encode it as a base-62 string using the character set 0-9, a-z, A-Z. The empty string is not a valid output - the integer 0 should encode to '0'. Return the encoded string.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.