Coding:
These are taken straight from LeetCode. You'll get 2 mediums or hards.
Merge k sorted linked lists
Find the Kth largest element in O(n) time.
Behavioral
Preparation - Make sure you can discuss a project where you designed something that handles a very high number of queries per second. The interviewer was very disappointed by my project that had low QPS.
Talk about a project that you worked on.
What was the performance bottleneck?
How did you solve it?
What were the options and tradeoffs?
What was the result?
System Design
Imagine you have 100 new iPhones and you're going to sell them at a massive discount for a promotion for $100/phone. This promotion starts at exactly 12:00. You anticipate 100 million users will try to buy the phones. Design a system for this promotion.
My approach:
- Have a CDN with 2 pages - one page allowing people to enter a waiting room and one page telling people that the phones have been sold.
- From 12:00:00 to 12:00:10, you show the page to enter the waiting room. After 12:00:10, you show the page telling people the phones have been sold.
- Only 1,000 people are allowed in the waiting room. The rest are told the phones have been sold.
- The first 120 people in the waiting room are allowed 5 minutes to complete their purchase. If 100 phones sell, then the remaining 20 are told that the promotion is over.
- If the phones don't sell immediately, the you must allow people from the waiting room to try to purchase the phones in a FIFO manner.
- Make sure to use a SQL database to manage the inventory for the iPhones.
- If the waiting room service fails, then you must start recovery. Use a messaging queue to restore the waiting room service.