Amazon Interview Questions 2026
304 real interview questions asked at Amazon. Covers DSA / Arrays, System Design, DSA / Graphs, Behavioral, Domain, DSA / Trees, Data Engineering / PySpark, Product / Backlog Prioritization, AWS / IAM and S3, React / Performance, React / Core Web Vitals, React / Memory, React / Profiling, React / Hooks, Node.js / Memory, Node.js / Event Loop, SQL / Query Optimization, SQL / PostgreSQL, SQL / Schema Design, SQL / Schema Migration, SQL / Replication, System Design / Social Media, System Design / URL Shortener, System Design / Messaging, System Design / Migration, System Design / Rate Limiting, System Design / Resilience, Java / JVM, Java / Data Structures, Java / Concurrency, Python / Async, Python / GIL, AWS / Lambda, AWS / Serverless, AWS / DynamoDB, DevOps / Kubernetes, DevOps / Kubernetes Networking, Kafka / Consumer, Kafka / Exactly Once, Microservices / Saga Pattern, Microservices / Resilience, TypeScript / Generics, Security / XSS, Behavioral / Incident Management, Behavioral / Team Dynamics, Behavioral / Career Growth, DSA / Hash Maps, DSA / Sliding Window, DSA / Stack, DSA / Real-world Algorithms, DSA / Data Structures, DSA / Heaps, Performance / Latency Tail, Performance / Cost Optimization, Performance / Caching, Performance / Logging, React / Concurrent Features, React / Internals, React / Race Conditions, Java / Collections, Java / JMM, Java / Async, Python / Advanced Python, SQL / Performance, SQL / Data Migration, DevOps / Database Migrations, Security / Rate Limiting, System Design / Scheduler, System Design / Booking System, TypeScript / Advanced Types, MongoDB / Replication, Behavioral / Code Review, Behavioral / Technical Leadership, DSA / Linked Lists, DSA / Dynamic Programming, DSA / Backtracking, DSA / Greedy, Performance / Database, Performance / Architecture, Performance / Connection Pooling, Behavioral / Conflict, Behavioral / Mentoring, Behavioral / Leadership, React / Lifecycle, React / Forms, Node.js / Observability, Node.js / Deduplication, Node.js / Native Addons, Node.js / Production, SQL / Connection Pooling, SQL / Analytics, SQL / Database Theory, AWS / Messaging, AWS / ElastiCache, Microservices / Data Consistency, Microservices / Observability, Microservices / API Design, Microservices / Sagas, Microservices / Architecture, Microservices / Zero-downtime Deploy, Security / IDOR, DevOps / Incident Investigation, Microservices / Migration, Behavioral / Conflict Resolution, DevOps / Hotfix, Node.js / Deep Clone, React / Re-render Optimization, DevOps / Debugging, Behavioral / Testing, Node.js / Throttle, Architecture / Feature Flags, Redis / Cache Stampede, Redis / High Availability, Redis / Persistence, Redis / Distributed Systems, Redis / Memory, Redis / Performance, Redis / Messaging, Elasticsearch / Query Optimization, GraphQL / Security, GraphQL / Performance, GraphQL / Observability, GraphQL / Execution, DSA / Two Pointers, DSA / Stacks and Queues, DSA / BFS, DSA / Heap, React / Context, React / Advanced React, Java / Design Patterns, Node.js / Threading, Node.js / Performance, Python / Decorators, Python / Memory, System Design / Distributed Systems, System Design / Architecture, System Design / Notifications, DSA / Linked List, DSA / Binary Search, Behavioral / Prioritization, Behavioral / Communication, Behavioral / Product, Behavioral / Incident Response, Behavioral / Collaboration, Behavioral / Estimation, Security / Cryptography, DevOps / Deployment, DevOps / Database, DevOps / CI/CD, DevOps / Service Mesh, DevOps / Monitoring, SQL / ORM Performance, SQL / Indexing, SQL / Scaling, SQL / Views, SQL / Concurrency, Kafka / Consumer Groups, Kafka / Performance, Kafka / Delivery Semantics, Kafka / Ordering, Kafka / Storage, Elasticsearch / Internals, Elasticsearch / Cluster Management, Elasticsearch / Search, Data Engineering / Distributed Systems, System Design / Scaling, Architecture / Event Sourcing, Architecture / Resilience, System Design / Networking, Architecture / Rate Limiting, React / Reconciliation, Java / Spring Boot, Architecture / Microservices, Java / Resilience, Redis / Data Structures, Redis / Resilience, Security / Auth, System Design / CDN, Architecture / Database, Debugging / Production, System Design / Consistency, System Design / Concurrency, Architecture / API Design, Architecture / Migration, DSA / Heap/QuickSelect, DSA / Graph, DSA / Trie, DSA / Sorting, Java / Memory, Behavioral / Product Management, JavaScript / V8 Engine, Architecture / Developer Experience, Security / OAuth, System Design / Search, JavaScript / Language Internals, TypeScript / Migration, DevOps / Load Balancing, DevOps / Observability, DevOps / Feature Flags, Security / Authentication, JavaScript / Event Loop, React / Concurrent, React / Architecture, DevOps / Security, DevOps / GitOps, DevOps / High Availability, Security / SSRF, Java / Java 21, Java / Modern Java, System Design / Video Streaming, System Design / Leaderboard, DevOps / Helm, Architecture / Best Practices, React / UX Patterns, Architecture / Messaging, Python / Data Structures. Reported by engineers who went through the Amazon process.
DSA / Arrays (6)
Given an array of integers and a target sum, return all unique triplets that sum to the target. Discuss time and space complexity. Then extend the problem to k-sum and analyze how recursion depth changes performance for large k.
Given an array of integers, find the length of the longest subarray with a sum equal to zero. Explain the prefix sum + HashMap approach and why the naive O(n2) solution is unacceptable for large inputs.
Given an array of intervals, merge all overlapping intervals. Return the minimum number of intervals after merging. Example: [[1,3],[2,6],[8,10],[15,18]] → [[1,6],[8,10],[15,18]]
Given a list of intervals sorted by start time, insert a new interval and merge if necessary. Return the updated list.
Given an array, find the maximum sum of a subarray (Kadane's algorithm). Then extend: return the actual subarray indices, not just the sum.
Find the first missing positive integer in an unsorted array. Must be O(n) time and O(1) extra space.
System Design (3)
Design a distributed rate limiter that can handle 10M requests per second across multiple data centers. Discuss consistency tradeoffs, the choice between token bucket vs leaky bucket, and how you would handle clock skew across regions.
Design Amazon's recommendation engine (customers who bought X also bought Y). Cover: collaborative filtering vs content-based, item-item similarity at scale, real-time vs batch computation, and how you handle the cold-start problem for new products.
Design a notification system (push/email/SMS) that sends 10 million notifications per day to users across time zones with delivery guarantees.
DSA / Graphs (3)
Given a directed graph representing service dependencies, detect all strongly connected components and explain how this maps to identifying circular dependencies in a microservices architecture.
You have a graph of cities with flight prices between them. Find the cheapest flight from source to destination with at most K stops.
Implement Dijkstra's algorithm for shortest path. A city has 1000 nodes and 5000 edges. What data structure gives best performance?
Behavioral (2)
Tell me about a time you had to deliver a project under a very tight deadline. What trade-offs did you make and how did you communicate them to stakeholders? Which Amazon Leadership Principle guided your decision?
Describe a time you disagreed with a decision made by your team or manager. How did you raise the concern? What was the outcome? (Amazon LP: Have Backbone; Disagree and Commit)
Domain (1)
Explain Amazon's DynamoDB single-table design pattern. Why do you put multiple entity types in one table? Walk through a real example with access patterns, partition key / sort key design, and GSI usage.
DSA / Trees (8)
Serialize and deserialize a binary tree. Implement both functions and explain why BFS serialization makes deserialization simpler than DFS. What is the time and space complexity?
Given a binary tree, find the longest path between any two nodes (not necessarily through root). You have 30 minutes.
Given a binary search tree, find the k-th smallest element. Can you do it without building a sorted array?
Implement a function to serialize and deserialize a binary tree. The serialized format must allow perfect reconstruction.
Given a binary tree, check if it's a valid Binary Search Tree. Consider all possible edge cases.
Given a binary tree, return the level-order traversal as a list of lists.
Write an algorithm to serialize and deserialize a binary tree.
Write a function to check if a binary tree is a valid Binary Search Tree (BST).
Data Engineering / PySpark (1)
You have a Spark job that ingests 500GB of clickstream data daily. It is failing with OOM errors on the executor. How do you debug and fix it?
Product / Backlog Prioritization (1)
How do you prioritize a backlog when you have 50 features requested by 10 different stakeholders?
AWS / IAM and S3 (1)
What is the difference between an S3 bucket policy, IAM policy, and S3 ACL? Which takes precedence?
React / Performance (6)
Your React app renders a list of 50,000 rows. Users report severe lag when scrolling. The current implementation maps over the entire array and renders each row as a component. Walk me through exactly how you'd fix this without changing the data source.
A user reports that typing in a search input feels 'laggy' only when there are many results showing below. Nothing in the input code changed. Explain and fix.
What is the difference between React.memo, useMemo, and useCallback? Give an example where each is the right tool.
Your React app has a form with 50 fields. On each keystroke, the entire form re-renders taking 200ms. How do you fix this?
Your React SPA loads slowly on first visit (8 seconds). Bundle size is 5MB. How do you optimize?
What is the purpose of React.Profiler component and how do you use it to find performance bottlenecks?
React / Core Web Vitals (1)
Your team ships a React app and Lighthouse shows CLS (Cumulative Layout Shift) of 0.45. Users see content jumping on load. No one on the team has touched layout recently. How do you diagnose and fix it?
React / Memory (1)
You notice your React app's memory usage grows from 80MB to 400MB over 30 minutes of normal usage. There are no error logs. How do you identify and fix the memory leak?
React / Profiling (1)
After adding React DevTools Profiler, you see a component called UserAvatar re-rendering 200 times per second even when no user data changes. What are the most likely causes?
React / Hooks (1)
Explain the difference between useLayoutEffect and useEffect. Give a real scenario where using useEffect instead of useLayoutEffect causes a visible bug.
Node.js / Memory (3)
Your Node.js API handles 500 requests/second in staging. In production at 2000 req/sec, memory climbs to 8GB and the process crashes after 20 minutes. How do you diagnose and fix this?
A Node.js service crashes every night at 2 AM with 'FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory'. There's a cron job that runs at 1:55 AM. Explain the likely cause and your fix.
Your Node.js API has memory usage growing from 100MB to 800MB over 24 hours with stable traffic. How do you find the leak?
Node.js / Event Loop (3)
Explain the Node.js event loop phases in order. A setTimeout(fn, 0) and setImmediate(fn) are both queued. Which runs first and why? What if they're inside an I/O callback?
Explain how Node.js handles CPU-intensive tasks without worker threads. What happens to the event loop and all pending HTTP requests while a heavy computation runs?
Explain the difference between process.nextTick() and Promise.then() in the event loop. Which executes first?
SQL / Query Optimization (4)
You have a query that takes 45 seconds on a table with 50 million rows. EXPLAIN shows a full table scan. The WHERE clause filters on user_id and created_at. There's already an index on user_id. What do you do?
Your query has LEFT JOIN to a large table but most rows in the result have NULL for the joined table columns. EXPLAIN shows full scan of the joined table. How do you optimize?
You have a table with 500 million rows. A query runs in 0.1s in development (10K rows) but 45 seconds in production. Same index exists on both. Why?
You notice a SQL query uses an index, but adding ORDER BY makes it 10x slower. Explain why and how to fix it.
SQL / PostgreSQL (1)
Your PostgreSQL database has a table with 200 million records. A nightly batch job runs UPDATE on 5 million rows. The next morning, queries that were taking 50ms now take 8 seconds. What happened and how do you fix it?
SQL / Schema Design (1)
Design a database schema for an e-commerce platform that handles flash sales. During a flash sale, 10,000 users try to buy the last 100 units simultaneously. Your schema must prevent overselling. Show the schema and the critical query.
SQL / Schema Migration (1)
A developer adds a NOT NULL constraint to a column in a production table with 100 million rows. The ALTER TABLE runs for 6 hours and locks the table. How should this have been done?
SQL / Replication (1)
Your database read replicas are always 30 seconds behind the primary. During this lag, users see stale data after updating their profile. How do you handle read-after-write consistency without routing all reads to primary?
System Design / Social Media (1)
Design Instagram's newsfeed. 500 million users, each follows up to 2000 accounts. Feed must load in under 200ms. How do you architect this?
System Design / URL Shortener (2)
Design a URL shortener like bit.ly. It needs to handle 100 million URLs, 10 billion reads per day, and the short URLs must never collide. Walk through your complete design.
Design a URL shortener like bit.ly that handles 100K writes and 10M reads per day. The shortened URLs should never expire.
System Design / Messaging (1)
Design WhatsApp's message delivery system. Messages must be delivered exactly once, in order, and the sender must know when the recipient read the message. Handle 50 billion messages per day.
System Design / Migration (1)
Your company's monolith handles 10,000 requests/second. The checkout service is the bottleneck. How do you extract it into a microservice without downtime and without breaking existing functionality?
System Design / Rate Limiting (1)
Design a distributed rate limiter that works across 50 geographically distributed servers without a centralized bottleneck. It must allow 1000 requests per user per minute globally.
System Design / Resilience (1)
Your microservices communicate via synchronous REST calls. Service A calls B, B calls C, C calls D. D is slow and times out, causing a cascade failure that takes down A. How do you redesign this to be resilient?
Java / JVM (2)
Explain how Java's Garbage Collector works in G1GC mode. Your application has 8GB heap and full GCs every 10 minutes cause 5-second pauses. How do you tune this?
In a Java 17 application, you see OutOfMemoryError: Metaspace. The heap is fine. What is Metaspace, what causes it to fill up, and how do you fix it?
Java / Data Structures (1)
Design a thread-safe cache in Java that: evicts the least recently used entry when full, has O(1) get and put, and handles concurrent access without a global lock.
Java / Concurrency (5)
Explain the difference between synchronized, ReentrantLock, ReadWriteLock, and StampedLock. Give a scenario where each is the right choice.
Your Java service has two threads simultaneously checking product stock (quantity=1). Both see available and create orders, resulting in quantity=-1. Fix this.
What is the difference between volatile and synchronized in Java? When is volatile sufficient?
Explain what a deadlock is and how to prevent one in a multi-threaded Java application.
What is the Fork/Join framework in Java? How does it differ from ExecutorService for CPU-bound tasks?
Python / Async (1)
Your Python FastAPI service handles 1000 requests/second. Adding one blocking I/O call (requests.get()) drops throughput to 50 requests/second. Why and how do you fix it without rewriting the service?
Python / GIL (1)
Explain Python's GIL. You have CPU-bound code that you parallelized with threading. It's not faster. Why? How do you actually make it faster?
AWS / Lambda (2)
Your AWS Lambda function processes S3 events. Under high load, you notice some events are processed twice, causing duplicate records in DynamoDB. Lambda is configured with at-least-once delivery. How do you fix this?
What is Lambda cold start and why does it happen? Name two concrete techniques to reduce its impact on a latency-sensitive API.
AWS / Serverless (1)
Your API Gateway + Lambda architecture handles 10,000 requests/second normally. During a flash sale, it receives 100,000 requests/second. Lambda concurrency limit is 1000. What happens and how do you handle this?
AWS / DynamoDB (2)
You're using DynamoDB for a social media app. Users can like posts. You need to count total likes per post in real-time. A naive counter update causes hot partition issues at viral posts. How do you solve this?
Your DynamoDB table has a hot partition because 80% of reads go to the same partition key (a popular user). How do you solve this?
DevOps / Kubernetes (8)
Your Kubernetes pod keeps crashing with OOMKilled. You set memory limit to 512Mi. The application normally uses 300Mi but spikes to 600Mi on certain requests. How do you fix this without just raising the limit?
After deploying a new version in Kubernetes, users report intermittent errors. 30% of requests fail, 70% succeed. Rollback is taking 10 minutes and you need a faster solution right now.
Your Kubernetes cluster nodes are at 80% memory utilization. Adding pods fails with 'Insufficient memory'. You have 10 nodes. Some pods have no resource limits set. What's your investigation and remediation plan?
Explain the difference between liveness probe and readiness probe in Kubernetes. What happens if you configure liveness probe too aggressively?
Your Kubernetes pod keeps crashing with OOMKilled. How do you diagnose and fix it?
What is Kubernetes horizontal pod autoscaling (HPA) and what metrics can it scale on?
Explain Kubernetes Deployments vs StatefulSets. When would you use a StatefulSet?
Your Kubernetes cluster has nodes running at 95% CPU. New pods are in Pending state. How do you resolve this?
DevOps / Kubernetes Networking (1)
Explain how Kubernetes networking works when Pod A calls Pod B by service name. Trace the exact path of the network packet.
Kafka / Consumer (1)
Your Kafka consumer group has 10 consumers and 10 partitions. One consumer is slower than others and keeps getting rebalances, causing other consumers to pause processing. How do you fix this?
Kafka / Exactly Once (1)
You need Kafka to guarantee exactly-once message processing from producer to consumer, including writing to a database. Explain what you need to configure at each layer.
Microservices / Saga Pattern (1)
Design a system where microservice A must call microservices B, C, and D. If any one fails, the entire operation must rollback. B and C have already succeeded when D fails. How do you handle this?
Microservices / Resilience (1)
Your microservices use synchronous REST calls and you're experiencing cascading failures. You implement circuit breakers, but during the open state, users get blank pages. How do you improve user experience during failures?
TypeScript / Generics (1)
You have a TypeScript generic function that takes an object and a key. It should return the value at that key in a type-safe way so callers get proper autocomplete. Write the function signature.
Security / XSS (2)
You discover a reflected XSS vulnerability in your React application despite React's automatic escaping. How is this possible in React?
Explain content security policy (CSP). How does it protect against XSS?
Behavioral / Incident Management (1)
You deployed a change that caused a production outage lasting 2 hours. How do you handle the immediate aftermath and what do you do in the days after?
Behavioral / Team Dynamics (1)
A senior engineer on your team consistently writes correct but unreadable code and refuses code review feedback. Other team members are increasingly frustrated. You're not their manager. What do you do?
Behavioral / Career Growth (1)
Your performance review is coming up. You've done excellent technical work but you're 'below expectations' because you don't write status updates and don't speak up in meetings. How do you respond to this feedback?
DSA / Hash Maps (1)
You have a function that runs in O(n²) time and your interviewer says 'this is too slow for n=10 million.' The function finds all pairs of numbers in an array that sum to a target. Optimize it to O(n).
DSA / Sliding Window (2)
You're implementing a rate limiter using a sliding window algorithm. Given a stream of timestamps (Unix milliseconds), return true if a request is within the limit of 100 requests per minute. The stream can have 1 billion events.
Given a string, find the length of the longest substring without repeating characters.
DSA / Stack (2)
Design a data structure that supports push, pop, and getMin in O(1) time and O(1) space (beyond the stack itself).
Given a matrix of 0s and 1s, find the largest rectangle containing only 1s.
DSA / Real-world Algorithms (1)
You have a log file where each line has a timestamp and user ID. Find the K users who appear most frequently in the last N minutes. The file is 100GB and is being written to in real-time.
DSA / Data Structures (4)
Implement an LRU (Least Recently Used) cache with O(1) get and O(1) put. Explain why a naive HashMap alone doesn't solve this.
Design a data structure for a phone directory that supports: addNumber, removeNumber, getAny (return any available number). All operations O(1).
Implement LRU Cache with O(1) get and put operations.
Implement a stack that supports push, pop, top, and getMin in O(1) time.
DSA / Heaps (2)
Find the median of a stream of numbers. Numbers arrive one at a time. After each addition, you must be able to return the current median in O(log n) time.
You have a stream of integers. At any point, you can be asked for the median. Implement a data structure that supports add(num) in O(log n) and getMedian() in O(1).
Performance / Latency Tail (1)
Your API's p99 latency is 3 seconds but p50 is 50ms. Most users have a great experience but 1% see extreme slowness. How do you investigate the outliers?
Performance / Cost Optimization (1)
You're asked to reduce your service's AWS costs by 40% without degrading performance. Where do you start?
Performance / Caching (2)
Your team wants to add caching everywhere to improve performance. What questions would you ask before adding any cache?
Your API response time is 200ms. You add Redis caching. Response time drops to 20ms for cache hits but is now 400ms for cache misses (double the original). What happened?
Performance / Logging (1)
A microservice that was handling 500 req/sec now crashes at 100 req/sec after adding a new feature. The feature adds one line: logging the full request body. What's happening?
React / Concurrent Features (1)
Explain Concurrent React. What problem does it solve and how does startTransition help? Give a real example where it improves UX.
React / Internals (1)
What is React's Fiber architecture and why was it introduced? How does it enable concurrent features?
React / Race Conditions (1)
Your React app has a race condition: user types in search, two API calls are made, the slower one returns last and overwrites the correct result. Fix it.
Java / Collections (1)
What is the difference between HashMap and ConcurrentHashMap at the implementation level? When does ConcurrentHashMap still cause problems?
Java / JMM (2)
What is the Java Memory Model (JMM)? Give a specific example where code behaves correctly in single-threaded but incorrectly in multi-threaded execution without synchronization.
What is the Java memory model and happens-before relationship? Why does it matter for concurrent code?
Java / Async (2)
Explain CompletableFuture in Java 8+. How do you run 3 API calls in parallel and combine results when all complete?
Explain how Java's CompletableFuture works. How do you chain async operations and handle errors?
Python / Advanced Python (2)
Explain Python's descriptor protocol. How does @property use it? Write a descriptor that validates a positive integer.
Explain Python metaclasses. When would you actually use one in production code?
SQL / Performance (2)
Your application runs this query every second: SELECT count(*) FROM orders WHERE status='processing'. The count is displayed on a dashboard. The orders table has 100M rows. How do you make this fast?
How do you optimize a slow COUNT(*) query on a table with 100 million rows?
SQL / Data Migration (1)
You need to move 50 million rows from table A to table B (archive) and delete them from A. How do you do this without locking the production table?
DevOps / Database Migrations (1)
You need zero-downtime database schema changes in production. Your service has 50 instances running. How do you add a NOT NULL column to a high-traffic table?
Security / Rate Limiting (1)
A rate limiting mechanism blocks requests after 100/minute. An attacker sends 99 requests/minute from 1000 different IPs. Your rate limiter doesn't catch this. What type of attack is this and how do you mitigate it?
System Design / Scheduler (2)
Design a distributed job scheduler like AWS Batch. Jobs have dependencies (job B starts only after job A completes). The system must handle 100K jobs per day.
Design a distributed task scheduler for 10 million scheduled tasks (delayed, recurring, one-time).
System Design / Booking System (1)
Design a hotel booking system. Rooms must not be double-booked. Searches should show real-time availability. Handle 10,000 concurrent booking attempts for popular dates.
TypeScript / Advanced Types (2)
What are TypeScript conditional types? Write a type that returns the element type of an array, or the type itself if not an array.
Explain TypeScript's conditional types. Write one that extracts the return type of a Promise.
MongoDB / Replication (2)
Your MongoDB replica set has 3 nodes. The primary goes down. How long before writes can resume and what determines this?
Explain MongoDB's write concern and read preference options. What trade-offs do they make?
Behavioral / Code Review (2)
A team member submits a PR with 3000 lines of code changes. How do you approach the code review?
You notice a senior engineer's code in a PR has a significant flaw that they missed. How do you handle the review?
Behavioral / Technical Leadership (1)
You're given a task that you believe is technically wrong. The approach will work but will create significant technical debt. Your manager wants it done 'the quick way.' What do you do?
DSA / Linked Lists (1)
Implement a function to detect a cycle in a linked list. What is Floyd's cycle detection algorithm and why is it O(1) space?
DSA / Dynamic Programming (7)
You have an array of stock prices. Find the maximum profit from at most 2 transactions (buy-sell cycles). You must sell before buying again.
Given an m x n grid of integers, find the path from top-left to bottom-right that maximizes the sum. You can only move right or down.
Find the longest increasing subsequence in an array. Must be O(n log n).
Given a string, find the minimum number of characters to insert to make it a palindrome.
Write a function to find the longest palindromic substring in a string. What is the optimal approach?
Given an array, find the maximum sum subarray (Kadane's algorithm). Explain the dynamic programming insight.
Implement a function that finds the longest common subsequence (LCS) of two strings.
DSA / Backtracking (4)
Implement a function that returns all permutations of a string. If string has duplicates, return unique permutations only.
Implement a function that, given an integer n, returns all valid combinations of n pairs of parentheses.
Write a function to find all valid parentheses combinations for n pairs.
Write a function to compute the power set (all subsets) of a given set.
DSA / Greedy (1)
You have N tasks, each with a deadline and profit. You can do at most one task per unit of time. Maximize total profit. (Job Scheduling with deadlines)
Performance / Database (1)
You notice your database CPU is fine but disk I/O is at 100%. Queries are fast individually but slow under concurrent load. What's happening?
Performance / Architecture (1)
An engineer proposes adding an in-memory cache to every service to reduce database load. What are the problems with this approach at scale?
Performance / Connection Pooling (1)
Design a connection pool for database connections. What parameters would you expose and what are the failure modes?
Behavioral / Conflict (1)
Your code review comment is dismissed repeatedly by a senior engineer who says 'it works, don't overthink it.' The code has a potential race condition you're certain about. What do you do?
Behavioral / Mentoring (1)
You're mentoring a junior developer who is technically brilliant but writes code that no one else can understand. How do you improve this?
Behavioral / Leadership (2)
Your team just launched a feature and a competitor launched an almost identical feature 2 days earlier. A manager blames 'slow engineers.' How do you respond professionally?
Your team has low morale after a failed product launch. How do you help the team recover?
React / Lifecycle (1)
Explain the React rendering lifecycle in a functional component with hooks. In what exact order do useState, useEffect, and useLayoutEffect fire during mount and update?
React / Forms (1)
Your React form has complex validation: some fields depend on others, some validation is async (API calls). How do you architect this without the form becoming unmanageable?
Node.js / Observability (1)
Your Node.js service uses Express and you want to implement request tracing across microservices. Each log line should show the same trace ID for the same request, even across async operations.
Node.js / Deduplication (1)
Design a Node.js service that must process exactly one event per user per day (deduplication). Events arrive out of order and can have duplicates. You have Redis available.
Node.js / Native Addons (1)
What is the N-API and why is it important for Node.js native addons? When would you write a native addon?
Node.js / Production (1)
Explain graceful shutdown in a Node.js service. What happens to in-flight requests when you kill the process without it?
SQL / Connection Pooling (1)
Explain database connection pool sizing. A service has 4 CPU cores and connects to PostgreSQL. What's the optimal pool size?
SQL / Analytics (1)
Write a SQL query to detect customers who haven't made a purchase in the last 30 days but were active in the 30 days before that (churned customers).
SQL / Database Theory (1)
Explain the CAP theorem with a real database example for each combination. Which pair does a standard RDBMS choose?
AWS / Messaging (1)
Explain the difference between SQS, SNS, and EventBridge. A new developer says 'they're all message queues.' Correct this.
AWS / ElastiCache (1)
Your application uses ElastiCache Redis. During a Redis failover (primary → replica promotion), your app throws connection errors for 30 seconds. How do you reduce this to under 5 seconds?
Microservices / Data Consistency (1)
Explain the Outbox Pattern. When is it necessary and how does it solve the dual-write problem?
Microservices / Observability (1)
Your 15 microservices all have their own logging format. Log aggregation is unusable because fields differ. How do you standardize this across teams without rewriting all services?
Microservices / API Design (1)
Design the API contract between microservices. When service A calls service B, how do you version the contract so service B can change without breaking service A?
Microservices / Sagas (1)
Explain the difference between choreography and orchestration in saga pattern. When would you choose each?
Microservices / Architecture (1)
Your microservices use HTTP REST. Under peak load, Service A waits synchronously for Service B which waits for Service C. Adding a new feature requires adding Service D to the chain. What's the systemic problem?
Microservices / Zero-downtime Deploy (1)
How do you handle database migrations when you have 10 instances of a service running and you need to add a NOT NULL column?
Security / IDOR (1)
A customer calls support at 2 AM. They say they can see another customer's order history when they click 'My Orders.' You're on call. Walk me through your incident response.
DevOps / Incident Investigation (1)
You deploy a new feature on Friday. Monday morning, your boss says 'sales dropped 30% over the weekend.' How do you investigate whether your deployment caused it?
Microservices / Migration (1)
Your company wants to migrate from a monolith to microservices in 6 months. You're asked to lead this. What's the first thing you tell management?
Behavioral / Conflict Resolution (1)
Your manager gives you a feature that conflicts with another team's ongoing work. Both are due in 2 weeks. You discover this conflict today. What do you do?
DevOps / Hotfix (1)
You need to give a production hotfix in 30 minutes. The bug is causing data corruption. You don't have time for a full review cycle. What's your process?
Node.js / Deep Clone (1)
Write a function to deep clone a JavaScript object without using JSON.parse/JSON.stringify. Handle: Date, RegExp, undefined, circular references.
React / Re-render Optimization (1)
Given a React component that renders 10,000 checkboxes, selecting one checkbox causes all 10,000 to re-render. Fix it without virtualizing.
DevOps / Debugging (1)
Your team merged 3 PRs simultaneously. Production broke. All 3 PRs look fine individually. What's the likely cause and how do you find it?
Behavioral / Testing (1)
A developer claims 'our tests are passing so production is fine.' Production has a bug. What testing gaps does this reveal?
Node.js / Throttle (1)
Implement a JavaScript function that throttles another function: no matter how many times it's called, it executes at most once per N milliseconds.
Architecture / Feature Flags (1)
Your team uses feature flags but they're managed as hardcoded constants in code. This means a code deploy is needed to toggle a feature. How do you improve this?
Redis / Cache Stampede (1)
Your Redis cache stores 100,000 keys. At midnight, all keys expire simultaneously (same TTL set when deployed). This causes a thundering herd that crashes your database. How do you prevent this?
Redis / High Availability (1)
You're using Redis as a session store. A Redis failover takes 30 seconds. During this time, all users are logged out. How do you make sessions resilient to Redis failures?
Redis / Persistence (2)
Explain Redis persistence options: RDB vs AOF. Your service can tolerate losing at most 1 second of data. Which do you configure?
How does Redis handle persistence? What are the trade-offs between RDB and AOF?
Redis / Distributed Systems (1)
Implement a distributed lock using Redis. What can go wrong with a naive SETNX approach?
Redis / Memory (1)
Redis is using 80% of available memory. Your application isn't caching more data than before. What could cause Redis memory growth?
Redis / Performance (1)
What is Redis pipelining and how does it differ from transactions? When should you use each?
Redis / Messaging (2)
Explain Redis pub/sub vs Redis Streams. When would you use each?
What is Redis Pub/Sub and how does it differ from using Redis as a message queue with Lists?
Elasticsearch / Query Optimization (1)
Your Elasticsearch query returns results in 200ms but users see 2 seconds because the frontend waits for all 20 facets to load. How do you optimize this?
GraphQL / Security (1)
Your GraphQL API has a query that allows clients to nest objects 10 levels deep. A malicious client sends a deeply nested query that takes 30 seconds and uses 4GB of memory. How do you prevent this?
GraphQL / Performance (1)
Explain the N+1 problem in GraphQL. You have a query that returns 100 posts, each with their author. Without optimization, this makes 101 database queries. Fix this.
GraphQL / Observability (1)
A client says your GraphQL API is 'too slow.' What metrics would you collect to diagnose this? What tools exist in the GraphQL ecosystem?
GraphQL / Execution (1)
Explain how GraphQL's execution model works. When does it execute resolvers in parallel vs sequentially?
DSA / Two Pointers (1)
Given an array of n integers, find all triplets that sum to zero. Remove duplicates from the result.
DSA / Stacks and Queues (1)
Implement a stack using only two queues. Then implement a queue using only two stacks.
DSA / BFS (2)
Design an algorithm to find the shortest path through a maze represented as a 2D grid. 0 = open, 1 = wall. Start at top-left, end at bottom-right.
Given a 2D grid, find the shortest path from start to end avoiding obstacles.
DSA / Heap (2)
Implement a min-heap data structure from scratch. Show insert and extractMin operations.
Implement a min-heap from scratch. What are the time complexities of insert and extractMin?
React / Context (1)
Explain how React context causes performance issues and how to solve them without third-party libraries.
React / Advanced React (1)
What is the purpose of React.cloneElement vs React.Children.map? When would you use each?
Java / Design Patterns (1)
Design a thread-safe singleton in Java. What are the pitfalls of double-checked locking?
Node.js / Threading (1)
What are Worker Threads in Node.js and how do they differ from child_process.fork()?
Node.js / Performance (1)
Explain how Node.js DNS resolution can unexpectedly block your service.
Python / Decorators (1)
Implement a Python decorator that retries a function up to N times with exponential backoff on specific exception types.
Python / Memory (1)
Explain Python's garbage collector alongside reference counting. When does reference counting fail?
System Design / Distributed Systems (2)
Design a distributed counter for 1 million increments per second across 100 servers tracking daily active users.
Design a distributed lock service. How does it ensure mutual exclusion across 10 servers?
System Design / Architecture (1)
Design an API gateway for 100K req/sec: authenticates, rate limits per user, routes to 20 microservices, adds observability.
System Design / Notifications (1)
Design a system to send 1 billion push notifications per day.
DSA / Linked List (1)
Write a function to detect if a linked list has a cycle. Can you do it without extra space?
DSA / Binary Search (1)
Implement binary search on a rotated sorted array (e.g., [4,5,6,7,0,1,2]).
Behavioral / Prioritization (1)
Your team is arguing about whether to refactor a critical service or ship a new feature. Both are urgent. How do you decide?
Behavioral / Communication (1)
You've been given a deadline that you know is impossible to meet. Your manager insists it's non-negotiable. What do you do?
Behavioral / Product (1)
Your company wants you to implement a feature you think will harm the user experience. How do you handle it?
Behavioral / Incident Response (1)
You've made a mistake that caused a production outage. How do you handle the aftermath?
Behavioral / Collaboration (1)
How do you handle disagreements with a product manager about feature scope?
Behavioral / Estimation (1)
You're asked to estimate a project that's similar to one that took twice as long as estimated last time. How do you estimate this time?
Security / Cryptography (1)
What is a timing attack and how do you prevent it in a password comparison function?
DevOps / Deployment (2)
Explain blue-green vs canary deployment. When would you choose each?
How would you implement blue-green deployment with database migrations?
DevOps / Database (1)
Explain how you would implement zero-downtime database migrations in a deployment pipeline.
DevOps / CI/CD (1)
Your CI/CD pipeline takes 45 minutes. How do you reduce it to under 10 minutes?
DevOps / Service Mesh (2)
What is a service mesh and what problem does it solve that a regular load balancer doesn't?
What is a sidecar proxy and how does it work in service mesh architecture?
DevOps / Monitoring (1)
Explain how Prometheus and Grafana work together for monitoring. What are the key metrics you'd track for a Node.js API?
SQL / ORM Performance (1)
What is the N+1 query problem? How do you detect it in production without reading every query?
SQL / Indexing (2)
What is a covering index? Show how adding one column to an index can change a query from a disk read to a memory read.
Explain how database indexes can SLOW DOWN queries. When would you remove an index?
SQL / Scaling (1)
Explain database partitioning vs sharding. When would you use each?
SQL / Views (1)
What is a materialized view and when would you use one over a regular view?
SQL / Concurrency (1)
What is the difference between optimistic and pessimistic locking in databases?
Kafka / Consumer Groups (1)
Explain Kafka consumer groups and how they enable parallelism. What happens if you have more consumers than partitions?
Kafka / Performance (1)
Your Kafka consumer is processing messages slowly. Messages pile up and consumer lag grows. How do you fix this?
Kafka / Delivery Semantics (1)
Explain Kafka's message delivery guarantees: at-most-once, at-least-once, exactly-once. How does each affect your consumer design?
Kafka / Ordering (1)
How does Kafka handle message ordering? Can you guarantee order across a topic with multiple partitions?
Kafka / Storage (1)
What is Kafka log compaction and when should you use it?
Elasticsearch / Internals (1)
Explain how Elasticsearch inverted index works. Why is it faster than SQL LIKE queries for full-text search?
Elasticsearch / Cluster Management (1)
Your Elasticsearch cluster has 3 nodes. You create an index with 5 primary shards and 1 replica each. How many shards total and how are they distributed?
Elasticsearch / Search (1)
Implement a search with Elasticsearch that: filters by category, full-text searches by name, and ranks by relevance + recency.
Data Engineering / Distributed Systems (1)
Explain the CAP theorem and how NoSQL databases make trade-offs around it.
System Design / Scaling (1)
Explain the difference between horizontal and vertical scaling. Give examples where vertical scaling is NOT the solution.
Architecture / Event Sourcing (1)
What is event sourcing and how does it differ from CRUD? What are the trade-offs?
Architecture / Resilience (1)
What is a circuit breaker pattern? How does it prevent cascade failures in microservices?
System Design / Networking (1)
Explain what happens when you type 'google.com' in a browser. Cover DNS, TCP, TLS, HTTP in sequence.
Architecture / Rate Limiting (1)
Explain rate limiting algorithms: token bucket, leaky bucket, fixed window, sliding window. Which is best for APIs?
React / Reconciliation (1)
How does React's reconciliation algorithm (Fiber) decide whether to update or replace a component?
Java / Spring Boot (2)
Design a distributed session system for a multi-instance Spring Boot application. Users shouldn't lose sessions when server restarts.
Your Java microservice has slow startup times (20 seconds) because it initializes many Spring beans. How do you reduce startup time?
Architecture / Microservices (2)
What is the Saga pattern in microservices? When would you choose choreography over orchestration?
Explain the difference between synchronous and asynchronous communication between microservices. When would each fail you?
Java / Resilience (1)
Your Spring Boot microservice calls another service via Feign client. The downstream service is slow (30 second response). How do you prevent your service from hanging?
Redis / Data Structures (1)
Explain Redis data structures and give a use case for each: String, Hash, List, Set, Sorted Set.
Redis / Resilience (1)
Your Redis cluster goes down. How do you design your application so it degrades gracefully?
Security / Auth (1)
Explain the difference between OAuth 2.0 and OpenID Connect (OIDC). Which one should you use for login?
System Design / CDN (1)
Explain how a CDN handles cache invalidation. What happens if you update a file and CDN serves the old version?
Architecture / Database (3)
What is database connection pooling? Why would you NOT want too large a connection pool?
How do you implement database read replicas and what queries should you route where?
Your production database has a table missing an index. Adding the index on 1 billion rows. How do you do this safely?
Debugging / Production (1)
Your new feature is working in development but failing in production. No exception is thrown. How do you systematically debug it?
System Design / Consistency (2)
Explain eventual consistency. Design a system where a user updates their profile picture and it shows consistently everywhere.
What is eventual consistency in distributed systems? How does Amazon S3 handle it?
System Design / Concurrency (1)
What is the difference between a process and a thread? How does Node.js achieve concurrency with a single thread?
Architecture / API Design (2)
Explain the differences between REST, GraphQL, and gRPC. Which would you choose for a mobile app backend?
You're designing an API for external developers. What versioning strategy would you use and why?
Architecture / Migration (1)
What is the Strangler Fig pattern for migrating from a monolith to microservices?
DSA / Heap/QuickSelect (1)
Implement a function to find the kth largest element in an unsorted array. Optimize for O(n) average case.
DSA / Graph (3)
Given a matrix of 0s and 1s, find the number of islands (connected components of 1s).
Implement topological sort on a directed acyclic graph (DAG). What's the real-world use case?
Implement Dijkstra's shortest path algorithm. What graph type is it NOT suitable for?
DSA / Trie (1)
Implement a Trie (prefix tree) with insert, search, and startsWith methods.
DSA / Sorting (1)
Explain and implement the Dutch National Flag algorithm for sorting an array with only 3 distinct values.
Java / Memory (1)
Explain Java's WeakReference, SoftReference, and PhantomReference. Give practical use cases.
Behavioral / Product Management (2)
How do you prioritize a backlog with 200 items and 5 competing stakeholders with different opinions?
What metrics do you track to measure if a new feature is successful? You launched 3 weeks ago.
JavaScript / V8 Engine (1)
Explain how garbage collection works in V8 (Node.js/Chrome). What causes GC pauses?
Architecture / Developer Experience (1)
What is the difference between a monorepo and polyrepo? What are the real trade-offs?
Security / OAuth (1)
Explain how OAuth 2.0 authorization code flow works. Why is it more secure than the implicit flow?
System Design / Search (2)
How would you implement search-as-you-type autocomplete for 10 million product names with <50ms response time?
Design a search engine for a 1 million product catalog with faceted filtering (category, price range, brand) and full-text search.
JavaScript / Language Internals (1)
What is tail call optimization and why doesn't JavaScript guarantee it despite ES6 spec?
TypeScript / Migration (1)
Your team wants to adopt TypeScript but has a 200K-line JavaScript codebase. What's the migration strategy?
DevOps / Load Balancing (1)
Explain how connection draining works in load balancers and why it's important for zero-downtime deployments.
DevOps / Observability (1)
Explain OpenTelemetry. How does it unify traces, metrics, and logs?
DevOps / Feature Flags (1)
Explain feature flags and how you use them for A/B testing and safe deployments.
Security / Authentication (1)
What is the difference between authentication with sessions vs JWT? Security trade-offs?
JavaScript / Event Loop (1)
How does the event loop work in JavaScript? What is the difference between microtasks and macrotasks?
React / Concurrent (1)
Explain the difference between React 17 and React 18 concurrent features. What is startTransition?
React / Architecture (1)
How do you handle global loading states and error handling in a React app with 50+ API calls?
DevOps / Security (1)
How does HashiCorp Vault work for secret management? How do you integrate it with Kubernetes?
DevOps / GitOps (1)
What is GitOps and how does ArgoCD implement it?
DevOps / High Availability (1)
Explain the difference between active-passive and active-active database configurations.
Security / SSRF (1)
What is SSRF (Server-Side Request Forgery) and give a real-world example of how it's exploited.
Java / Java 21 (1)
What is Project Loom (virtual threads) in Java 21? How does it change the threading model?
Java / Modern Java (1)
What is Java's sealed class hierarchy (Java 17+)? How does it improve pattern matching?
System Design / Video Streaming (1)
Design a video streaming service like Netflix. Focus on: video storage, encoding, CDN delivery.
System Design / Leaderboard (1)
Design a leaderboard system for a game with 10 million players updated in real-time.
DevOps / Helm (1)
Explain the differences between Helm 2 and Helm 3 for Kubernetes package management. What was removed and why?
Architecture / Best Practices (1)
Explain the Twelve-Factor App methodology. Pick 3 factors and explain how violating them causes production problems.
React / UX Patterns (1)
How do you implement optimistic UI updates in a React app with server synchronization?
Architecture / Messaging (1)
What is the difference between a message broker and an event streaming platform? Kafka vs RabbitMQ?
Python / Data Structures (1)
Explain how Python's dictionary achieves average O(1) lookup. What happens internally when two keys hash to the same bucket?
Practice these questions with AI feedback
Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.
Build my study plan →