The classic interview question
"Design a URL shortener" — turn a long link into sik.au/q0U. At scale: billions of links (shard them with consistent hashing), far more reads than writes (cache them), and short unique codes (count up and write the number in base62).
Short codes
const ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function toBase62(n) {
if (n === 0) return "0";
let code = "";
while (n > 0) {
code = ALPHABET[n % 62] + code;
n = Math.floor(n / 62);
}
return code;
}