Coding Interviews
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Design a url shortener service (similar to tinyurl).
1. Generate expiring unique short URL from provided URL
2. Redirect users to the correct website when they navigate to the short URL
A video service (like youtube) has many viewers watching videos. Given a stream of the video IDs that are being watched, we need to find the top K most viewed videos for different periods of time (1 hour, 1 day, 1 month, all time). For the top K videos returned, we also want the count of views during this period.
Sending user notifications is a common requirement in system design. Design a notification service for an organization. The system will use shared services for the underlying messaging implementation (email, sms, push notifications, etc) so the actual messaging implementation does not need to be designed. The system should support a user publishing a notification to a single user or groups of users. Notifications can be triggered manually via a web UI or programmatically via an API. Users should be able to view their past notifications they published. If a user is unable to receive a notification, they should still receive it at the next opportunity and not miss the message. The notification service should scale to billions of notifications per day, with messages delivered within a few seconds, with five 9s uptime.
Functional Requirements
1. As users type text in a search box, show the top 10 auto complete results with very low latency
2. Analytics will be collected on what the user types
Design a service with the following functional requirements
1. Users should be able to upload and download files
2. The files should be able to be shared with other users
3. Changes to the files should be pushed to other users with the content on their machine
4. There must be no risk of file corruption
5. Keep track of different versions of the files so they may be rolled back
6. Users should be able to edit files without an internet connection and the changes sync up when a connection becomes available
Design a social network website with the following functional requirements
1. Users should be able to post content with text, images or video 2. Users should be able to follow other users 3. Each user will have a relatively low latency feed which shows content posted by users they follow
Functional Requirements
The ability to set limits on the number of requests allowed within a specific timeframe
Keep performance and fault tolerance in mind
Functional Requirements
Users should be able to query plaintext documents (the twitter posts for this example)
Keep reliability and latency in mind
Functional Requirements:
1. Users can upload videos
2. Users can view videos
3. Search videos by video title
4. Videos should have like and view counts
5. Users can comment on videos
Design a relational model for a calendar application. The application will support users adding events with a specific time and time zone. Reminders about upcoming events will be pushed to users and have the ability to invite other users to events.
Design a monitoring and alerting service similar to PagerDuty that can be used to handle production incidents in real-time. The system should receive alerts from external systems, identify the severity of incidents, and notify on-call engineers through their preferred channels (e.g., SMS, email, or push notifications). The system should also support configurable on-call schedules with both primary and secondary engineers assigned to incidents. Additionally, the system must have an escalation mechanism to ensure incidents are addressed based on their priority. Describe how you would design the system to scale effectively and maintain reliability during peak loads.
A CDN (Content Distribution Network or Content Delivery Network) is a geographically distributed file storage service that is designed to serve static content to a large number of geographically distributed users quickly. Design a basic distributed storage system that could be used as a CDN.
Design a platform, similar to leetcode, which allows software engineers to prepare for coding interviews by answering coding questions and posting feedback on other users solutions. The platform should allow users with the correct permissions to be able to host coding competitions. The functional requirements are for a user to view a list of problems, view a specific problem, view specific coding solutions for that problem. The competitions also have their own functional requirements such as the ability to run and judge a user's code, and a live leaderboard and some metric for choosing who wins the competition. For non functional requirements, availability is of the most importance. Security when running the users code is also important. The competition needs to support 100k users and the live leaderboard should be give fresh results.
Design a reservation and payment system for a parking garage. Functional requirements include "spot booking", the ability to make payments, prevent booking the same parking spot, different classes of parking spots (compact,regular,large vehicles, handicap) with different prices. The non functional requirements include high consistency and availability.
Outline how you would create a tinder style dating app. The functional requirements are the ability to create user profiles, location based recommendations as well as the ability for a user to change their location (passport mode), preference settings, and matching algorithms. You can ignore chat functionality because that is often covered in other system design problems. The nonfunctional requirements are the ability for the application to scale to a large number of users as well as spikes in usage at different times. Availability and low latency are also a concern.
Proximity services help users find and access various services given their current location. The functional requirements are for users to be able to add an attraction such as a business and for users to be able to search for attractions and add reviews to attractions. The nonfunctional requirements are high scalability to support a large user base (50 million daily active users) as well as low latency and high availability. Assume 1,000 new attractions are added a day and the average users leaves 2 reviews per month.
Functional Requirements
1. Group chats
2. Send and receive messages in real time
3. Keep old messages in a database so users can view old group chats and messages
4. Notifications, read receipts and typical chat app functionality