Karat Interview-
5 System Design Questions:
- You want to create FB like social media platform with post functionality. Each user is having n friends and you need to show friends count with along with each post made by a user. How will you design/ approach on fetching the friends count with each post?
2 Tables were provided -
T1 having user details
T2 having user and friends mapping
Solution was expected for millions of users
2 You are working on Google Doc like system -
- Multiple users can work on same doc at run time
- one doc should be handled by one server only
- assume we have sufficient servers to handle the documents
Load balancer is working in round robin mode to permanently assign server to a doc
Q - What is the problem with the approach?
- Eventual or Strong consistency for :
- API call with allowed latency of 30 sec, retrieving metadata for video like author, genre, view count etc.
- A analytics web page system to record every click on hot webpages
- Banking system with deposit and withdrawal system
-
We have e-sign doc system (like docusign/echosign) and we need sign of 100+ people only after that document will be marked as complete. But due to a bug some people did not recieved notifications to sign the doc and those notifications are lost.
We have info - a) Table with records of all compelted docs b)logs from prod servers which are having details of successfully sent notifications only ( no failed ones)
Q- Post bug fix how to identify and send notification again to the failed ones? Consider a system with tens of millions of docs -
We have a system pipeline with multiple stages ( components) to process the documents and each component has its own processing capacity, let say we have A,B,C and having processing capacity of 10,20,50 docs then Q- What is the thoughput of system?
Coding Question -
we have a office attendance logs with us and need to find who has violated the flow : entry -> exit -> entry -> exit is the right flow and entry -> entry is the wrong flow and exit -> exit is also wrong flow
find and return the list of names with entry and exit violations
records1 = [
["Arjun", "enter"],
["Riya", "exit"],
["Arjun", "enter"],
["Arjun", "exit"],
["Meera", "exit"],
["Kabir", "enter"],
["Meera", "enter"],
["Amit", "enter"],
["Meera", "exit"],
["Sneha", "enter"],
["Kabir", "enter"],
["Rahul", "exit"],
["Rahul", "enter"],
["Kabir", "exit"],
["Meera", "enter"],
["Meera", "exit"],
["Sneha", "exit"],
["Kabir", "enter"],
["Kabir", "enter"],
["Meera", "exit"],
["Kabir", "exit"],
["Kabir", "exit"]
]
Expected output: ["Amit", "Rahul", "Arjun", "Kabir"], ["Meera", "Riya", "Rahul", "Kabir"]
records2 = [
["Arjun", "enter"],
["Arjun", "exit"],
]
Expected output: [], []
records3 = [
["Arjun", "enter"],
["Arjun", "enter"],
["Arjun", "exit"],
["Arjun", "exit"],
]
Expected output: ["Arjun"], ["Arjun"]


