Kotak Interview - SDE 2 (Bar Raiser round)
Summary
I had a 1.5-hour interview with Kotak for the SDE 2 role, covering problem solving, low-level design (LLD), and high-level design (HLD). The overall feedback from the interviewer was positive.
Full Experience
Duration: 1.5 hours
There were 3 parts in the interview
- Problem Solving
- LLD
- HLD
Problem Solving
I was asked 2 DSA questions:
-
Minimum length subarray with sum ≥ target – Solved using the sliding window technique to achieve O(n) time complexity
-
Search in a rotated sorted array – Implemented using a modified binary search approach.
LLD: Design Instagram
Functional Requirements
- Users should be able to follow each other.
- Users can create posts containing multiple photos/videos.
- Users can like and comment on posts.
Design Tasks
-
Database Schema Design
-
API Design (method signatures only)
- Add post
- Add comment
- Get comments
- Get likes
Missed adding pagination parameters for the “get comments” and “get likes” APIs, which was pointed out in feedback.
Design Principles / Patterns
- Discussed applicable design principles.
- Implemented the Observer Pattern to notify followers about new posts.
HLD
1. What issues occur when a celebrity posts content?
- Sudden surge in likes and comments causing very high concurrent writes. Solution: Use a message queue to process likes and comments asynchronously.
2. Reads become slow after a celebrity posts. How do you handle it?
- Massive read traffic for the same post. Solution:Cache celebrity posts and metadata (likes/comments count) using Redis.
Overall feedback from interviewer -> Majorly positive.
Interview Questions (5)
Minimum Length Subarray with Sum Greater Than or Equal to Target
Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarray, return 0 instead.
Search in Rotated Sorted Array
Given a sorted array nums that has been rotated at some pivot unknown to you beforehand, and an integer target, search for target in nums. If target is found in the array, return its index, otherwise return -1.
Low-Level Design (LLD): Instagram
Design Instagram covering functional requirements such as users being able to follow each other, create posts with multiple photos/videos, and like and comment on posts. Design tasks include Database Schema Design and API Design (method signatures for Add post, Add comment, Get comments, Get likes, considering pagination). Additionally, discuss applicable design principles and patterns, such as implementing the Observer Pattern to notify followers about new posts.
High-Level Design (HLD): Celebrity Post Write Scalability
Discussed the issues that occur when a celebrity posts content, specifically the sudden surge in likes and comments causing very high concurrent writes.
High-Level Design (HLD): Celebrity Post Read Scalability
Discussed how to handle slow reads after a celebrity posts, specifically massive read traffic for the same post.