Flipkart
Top Flipkart SDE Interview Questions 2026
Prep tips for Flipkart SDE
- DSA is heaviest — expect 2-3 rounds at LeetCode medium/hard level
- HLD for senior roles: design search, cart service, recommendation engine
- LLD round: design parking lot, elevator, ride-sharing — focus on OOP principles
- Strong focus on concurrency — thread-safe data structures, deadlock prevention
- Two approaches. (1) Min-heap of size k: iterate the array, push each element, if heap size exceeds k pop the min. After traversal the heap's root is the k-th largest. O(n log k). (2) QuickSelect (partition-based): average O(n), worst O(n²). Pick a pivot, partition; if pivot index == n-k return it, else recurse on the right side.
- Inverted index (Elasticsearch) over title, brand, attributes. First-pass retrieval by BM25 over the query terms. ML re-ranking with features: CTR, conversion rate, recency, personalization, inventory. Faceted filters (brand, price, rating) computed via aggregations. Spell correction via edit-distance dictionary + query log analysis. Cache hot queries in Redis.
- Classes: Cart, CartItem, Product, Coupon, PricingEngine. CartService as a singleton orchestrating operations. Thread-safe add/remove using a ConcurrentHashMap or optimistic locking with a version field. PricingEngine composes line-item price, item-level discount, cart-level coupon, taxes, shipping. Apply Strategy pattern for different coupon types (percent, flat, BOGO). Persist cart in Redis with TTL for anonymous users.
- Floyd's tortoise and hare. Slow pointer advances 1, fast advances 2. If they meet, there's a cycle. To find cycle start: after they meet, reset one pointer to head and advance both by 1 — they meet at the cycle entry. O(n) time, O(1) space.
- Pre-allocate inventory tokens in Redis (e.g., 10,000 tokens for 10,000 units). Atomic DECR rejects oversells. Use a queue (RabbitMQ/Kafka) for fairness — first-come-first-served by enqueue time. Distributed countdown across servers via NTP-synced clocks. Aggressive client-side throttling. Inventory reconciliation post-sale. Cache product page heavily to absorb pre-sale traffic.
- Array of linked list buckets for chaining. Hash function: (key.hashCode() & 0x7fffffff) % capacity. put: hash → bucket → walk list to update or append. get: hash → bucket → walk to find. Track size and load factor (default 0.75) — when exceeded, double capacity and rehash all entries. Amortized O(1) put/get. Open addressing is the alternative — better cache locality but worse on deletes.
- Hybrid system. Collaborative filtering using user-item matrix factorization (Spark ALS) for warm users. Item-based CF (similar products by co-purchase) for cold-start users. Content-based (product attributes, category embeddings) for cold-start items. Offline batch trains embeddings nightly; online serving from a feature store (Redis). Re-ranking layer with business rules (margin, inventory). A/B testing framework to validate variants.
- Single pass. Maintain max_current = max(num, max_current + num) and max_global = max(max_global, max_current). The intuition: at each index, either start a new subarray here or extend the previous one. O(n) time, O(1) space. Handle all-negative arrays correctly by initializing max_global to the first element.
- Classes: Elevator (state, current floor, direction), Floor, Request (source, destination, timestamp), ElevatorController (dispatch logic). State machine: IDLE → MOVING_UP/DOWN → DOOR_OPEN. SCAN algorithm: serve requests in current direction first, reverse when no more. Thread-safe request queue (PriorityQueue ordered by floor). For multi-elevator, dispatcher picks the elevator with the lowest "cost" (distance + direction match + current load).
- DFS that returns the height. At each node compute height(left) + height(right) — that's the path length passing through this node. Track a global max across all nodes. The diameter is the max path of edges, so add the two heights (number of edges = number of nodes - 1 on each side). O(n) time, O(h) recursion stack.
- Idempotency key per transaction (UUID from client). Synchronous auth, async capture/notification. Saga pattern across order, payment, inventory: each step has a compensating transaction (refund, restock). State machine: INITIATED → AUTHORIZED → CAPTURED/FAILED. Webhook from gateway to settle final state. Audit log immutable. Retry with exponential backoff for gateway timeouts.
- Three Java idioms: (1) Double-checked locking with a volatile field — check, lock, check again, instantiate. (2) Enum singleton (Bloch's recommendation) — serialization-safe, reflection-proof, lazy. (3) Initialize-on-demand holder — static nested class initialized only on first access; JVM guarantees thread safety. Avoid the early-Java mistake of synchronized getInstance() — slow on every call.
- Event-driven. Order state machine: PLACED → CONFIRMED → PACKED → SHIPPED → OUT_FOR_DELIVERY → DELIVERED. Each transition emits an event to Kafka. Tracking service consumes and updates a read-optimized store (Cassandra). WebSocket push to active mobile clients; SMS/push notification on key transitions. Carrier integration polls for status updates. Customer-facing API serves from the read store with low latency.
- Two pointers from each end. Skip non-alphanumeric chars. Compare lowercase. If any mismatch return false. If pointers cross, return true. O(n) time, O(1) space. Variant: "valid palindrome with one character removable" — when mismatch, try skipping one of the two characters and recheck.
- Backtracking with swap. At index i, swap each candidate from i..n-1 to position i, recurse on i+1, then swap back. Generates n! permutations in place — no auxiliary "used" set needed. Handle duplicates: skip swapping with a value already swapped at this position (use a local set per recursion level).
- Token bucket per user. Redis stores token count and last-refill timestamp; refill on each request based on time elapsed. Atomic via Lua script. Sliding window log alternative: Redis sorted set keyed by user, score = timestamp, expire old entries — count remaining. Different limits for authenticated vs unauthenticated; tier-based for premium APIs. Return 429 with Retry-After header.
Practice these questions with Cogniv
Get real-time AI answers during live mock interviews. Free to start.
Start practicing →