**LeetCode #75 - Sort Colors** \nBackground: You are given an array consisting of red, white, and blue, represented by 0, 1, and 2 respectively. Your task is to sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. \nProblem Statement: Implement a function `void sortColors(int[] nums)` that sorts the array in a single pass with O(n) time complexity and O(1) space complexity. \nExample 1: \nInput: nums = [2,0,2,1,1,0] \nOutput: [0,0,1,1,2,2] \nExplanation: The numbers are sorted in order where 0 represents red, 1 represents white, and 2 represents blue. \nExample 2: \nInput: nums = [2,0,1] \nOutput: [0,1,2] \nConstraints: `1 <= nums.length <= 300`, `nums[i]` is either 0, 1, or 2.
Coding Round 1 • Mid
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
**Design a URL Shortener** \nBackground: A URL shortener takes a long URL and converts it into a shorter, unique URL that redirects to the original URL. This process makes sharing URLs easier, especially on platforms with character limits. \nProblem Statement: Design a URL shortening service with the following functionalities: `shorten(url: String): String` to shorten a URL and `retrieve(shortened: String): String` to retrieve the original URL. Focus on scalability, storage, and handle issues like collisions. \nConstraints: The service should support up to billions of URLs and provide low latency.
System Design • Mid
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.