Flipkart Interview Questions
- DSA
- LLD
- HLD
Q1: Total Area of Rectangles
Description: You are given a 2D array of axis-aligned rectangles. Each rectangle is represented as [xi1, yi1, xi2, yi2], denoting bottom-left and top-right corners. Calculate the total area covered by all rectangles, counting overlapping regions once. Return the result modulo 109, +7, 10, 9, +7.
Example:
Input: rectangles = [[0,0,2,2],[1,0,2,3],[1,0,3,1]]
Output: 6
Explanation: The total area covered by all three rectangles is 6.
Q2: Largest Region in the “Moo” Game
Description: Given an N×N, N×N grid with cow ID numbers, find:
- The largest region of connected (adjacent) cells with the same number.
- The largest region using exactly two distinct numbers (must include both).
Key Approaches:
- BFS/DFS for connected component labeling.
- For single-cow region: standard flood-fill.
- For two-cow team: try all pairs, merge adjacent regions if valid.
Example:
Input: grid = [ [1, 1, 2, 2], [1, 1, 2, 2], [3, 3, 4, 4], [3, 3, 4, 4] ]
Output: 4 (The largest region is the 2×2 block of 1s or 2s)
Q3: Course Schedule
Description: Given a list of course prerequisites (as directed edges), determine if it’s possible to finish all courses (i.e., no cycles in the graph).
Example:
Input: numCourses = 2, prerequisites = [[1,0]]
Output: true (You can finish all courses)
Q4: Merge Intervals (and Variants)
Description: Given a set of intervals, merge all overlapping intervals.
Example:
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Intervals [1,3] and [2,6] overlap, so they are merged into [1,6].
Q5: Car Pooling
Description: Given trip requests (number of passengers, start, end), and capacity, determine if it’s possible to fulfill all trips without exceeding capacity at any point.
Example:
Input: trips = [[2,1,5],[3,3,7]], capacity = 4
Output: false (The capacity is exceeded at some point)
Q6: Minimize Max Distance to Gas Station
Description: Given positions of gas stations along a road and allowed to add K more, minimize the maximum distance between adjacent gas stations after the additions.
Example:
Input: stations = [1,2,3,5,6], K = 1
Output: 1.0 (Add a station at position 4 to minimize the maximum distance)
Q7: Maximum Rectangle with All 1s in Matrix
Description: Find the area or perimeter of the largest rectangle containing only 1s in a binary matrix.
Example:
Input: matrix = [ [1,0,1,0,0], [1,0,1,1,1], [1,1,1,1,1], [1,0,0,1,0] ]
Output: 6 (The largest rectangle is formed by the 1s in the last two rows)
Q8: Maximum Non-Adjacent Sum
Description: Given an array, find the maximum sum so that no two elements are adjacent.
Example:
Input: nums = [2,4,6,2,5]
Output: 13 (4 + 2 + 5)
Q9: Longest Consecutive Subsequence
Description: Given an array of positive integers, find the longest consecutive subsequence (numbers in a row, order doesn’t matter).
Example:
Input: nums = [100,4,200,1,3,2]
Output: 4 (The longest consecutive sequence is [1,2,3,4])
Q10: Next Permutation
Description: Rearrange elements to the next lexicographically greater permutation.
Example:
Input: nums = [1,2,3]
Output: [1,3,2]
Explanation: The next permutation is [1,3,2].
Q11: Zigzag String Conversion
Description: Convert a string into a zigzag pattern on k, k rows and read line by line.
Example:
Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Explanation: P A H N A P L S I I G Y I R
Reading line by line: “PAHNAPLSIIGYIR”
Q1. Car Rental System
Description: Design a car rental system that supports searching, reserving, cancelling cars, managing inventory per store, payments with multiple modes, and rental history. Focus on clean, extensible, OOP design.
Key Approaches:
- Clear division of class responsibilities (User, Vehicle [and subclasses], Store, Reservation, Bill, PaymentService, NotificationService).
- Use Factory pattern (vehicle), Strategy pattern (billing), Observer (notification), Singleton (ReservationManager).
- Ensure extensibility for adding vehicle/payment types.
Q2. Peer-to-Peer Parcel Delivery System
Description: Build a delivery system for parcel pickup/delivery between customers, supporting customer/driver onboarding, order creation/cancellation, auto assignment, in-memory storage, concurrency, order updates, and status tracking.
Key Approaches:
- OOP for customers, drivers, orders.
- Thread safety for concurrent updates.
- Observer for notifications.
- Scheduling/queues for unassigned order handling.
Q3. Machine Coding – Chat Platform
Description: Live coding to build a functioning chat application with multi-user support, must-have features, and good-to-have enhancements.
Key Approaches:
- OOP for users, messages, conversations.
- Data structures for chat state.
- Modular/extensible code for demo.
Q4. Machine Coding – E-commerce Billing
Description: Build a billing, discount, and loyalty system for e-commerce from scratch with separation of concerns, clean classes, and extensibility for real billing models.
Key Approaches:
- Encapsulation for bill, points, discounts.
- Modularity: separate billing, discount modules.
Q5. Machine Coding – Google Calendar Clone
Description: Core event-adding, updating, conflict checking, recurring events, and (optionally) reminders.
Key Approaches:
- Calendar/event classes; scheduling logic.
Q1. Car Pooling System
Description: Design a scalable car pooling (ride sharing) platform: ride booking, user management, assignment/matching logic, CAP theorem trade-offs, suitable databases, APIs, DB tables, activity diagrams, extensibility and resilience.
Key Approaches:
- Microservice architecture, user/ride/store services.
- Consistency vs availability, NoSQL vs SQL, message queues.
- RESTful APIs, clear activity flows.
- Diagrams for relationships and flows.
Q2. Design Spotify
Description: Architect a scalable music streaming platform supporting millions of users and tracks. Discuss service components (user, track, playlist, streaming, recs), DB/data choices, caching.
Key Approaches:
- Service decomposition, CDN for music assets, search/playlist engines, metadata storage, stream analytics.
Q3. Design Tournament Racing Game
Description: System for real-time racing, leaderboards, push notifications for leaderboard changes, zero lag.
Key Approaches:
- Real-time messaging (WebSocket), in-memory rankings, event-driven updates.
Q1. Previous Projects & Teamwork
Description: Detailed discussion on recent projects, collaboration, problem solving, and adaptability.
Q2. Engineering Fundamentals & Best Practices
Description: Evaluate performance, modularization, separation of concerns.
Q3. Hiring Manager Questions
Description: Team interaction, culture fit, aspirations, situational responses.