Design a URL shortening service similar to bit.ly that generates short aliases for long URLs and redirects users to the original destination.
Design the algorithm for generating short codes. Consider base62 encoding, collision handling, and the trade-offs between random vs sequential IDs.