All jobs / DevOps / SRE / cloud

DevOps / SRE / cloud interview question · 1–3 years

URL shortener: how do you generate the short code?

The strongest answer

Either hash the long URL and take the first characters, handling collisions by retry, or hand out pre-generated unique codes from a counter or key service; say which, and why — a counter gives guaranteed uniqueness but predictable codes, a hash is stateless but needs collision checks

Why it works

Right. Name the scheme and its trade-off.

What a good answer covers

Answers that fall short

Who gets asked this

More DevOps / SRE / cloud questions