Active problem-solving
Practice Prompts
Try it before you reveal. Each coding, algorithm, and system-design prompt unfolds in stages — approach, then solution — so you practice retrieval, not recognition. Mark what you solved; revisit the rest.
- CodeMid
Paginated REST endpoint with validation + auth
NestJSvalidationguardsBuild
GET /users?page=1&limit=20that is JWT-protected, validates query params, and returns a paginated result. Show the controller, the query DTO, and how the guard/pipe are wired.next: new - CodeSenior
Custom RolesGuard with the Reflector
NestJSauthRBACImplement a
@Roles('admin')decorator and aRolesGuardthat reads required roles from route metadata and compares them torequest.user.roles. Make method-level roles override class-level.next: new - CodeSenior
Retry with exponential backoff + jitter
NoderesilienceWrite
retry(fn, { retries, baseMs })that retries a failing async function with exponential backoff and jitter, only retrying transient errors, and gives up after N attempts.next: new - CodeMid
In-memory LRU cache (O(1))
Nodedata structuresImplement an LRU cache with O(1)
getandsetand a max capacity that evicts the least-recently-used entry.next: new - CodeSenior
Async pool with a concurrency limit
NodeasyncProcess 10,000 items by running an async
worker(item)with at most N in flight at once (a boundedPromise.all). Why not justPromise.all(items.map(worker))?next: new - CodeMid
Response-envelope TransformInterceptor
NestJSinterceptorsRxJSWrite an interceptor that wraps every successful response in
{ data, timestamp }without each handler knowing about it.next: new - CodeSenior
Stream a large file with backpressure
NodestreamsServe a multi-GB file as a gzipped download without loading it into memory, and make sure errors and resources are handled.
next: new - CodeSenior
Redis token-bucket rate limiter
NodeRedisrate limitingImplement a distributed token-bucket limiter (refill rate R, capacity C) that's correct across multiple app instances. Why must it be atomic?
next: new - CodeSenior
Fix GraphQL N+1 with DataLoader
NestJSGraphQLperformanceA
Post.authorfield resolver runs one query per post over a list of 50 posts (1+50 queries). Fix it with DataLoader and explain the two classic bugs.next: new - CodeSenior
Graceful shutdown for a Nest service
NestJSopsImplement graceful shutdown so a SIGTERM (k8s rollout) drains in-flight requests and closes resources before exit.
next: new - DesignArchitect
Design a multi-tenant SaaS API
architecturemulti-tenancyDesign the backend for a B2B SaaS where each tenant's data must be isolated. Cover the isolation model, tenant resolution, and how you prevent cross-tenant leakage.
next: new - DesignArchitect
Design an event-driven order pipeline
architecturemicroservicesmessagingAn order flows through payment, inventory, and shipping — separate services. Design it for reliability: no double charges, no lost orders, consistent state.
next: new - DesignArchitect
Design auth across an API gateway + microservices
architectureauthmicroservicesYou have a gateway and several backend services. Where do you authenticate and authorize, and how do downstream services trust the caller?
next: new - DesignSenior
Design caching for a read-heavy endpoint
architecturecachingperformanceA product-detail endpoint gets 50k RPS, 99% reads, data changes a few times a day. Design the caching so it's fast, fresh enough, and survives a cache miss storm.
next: new - DesignArchitect
Design idempotent payment processing
architectureresilienceClients retry on timeout, so a “charge card” request can arrive twice. Design the API + storage so a customer is never double-charged.
next: new - DesignSenior
Design observability for a Nest service
architectureobservabilityYou're on call for a Nest API and latency just spiked. Design the observability you'd want in place to diagnose it in minutes, not hours.
next: new - CodeMid
Sliding window: longest substring without repeats
DSAsliding windowReturn the length of the longest substring without repeating characters. Backend tie-in: the sliding-window pattern underlies rate limiting and log-window analytics.
next: new - CodeMid
Top-K frequent elements
DSAheapGiven an array, return the K most frequent elements. Backend tie-in: leaderboards, top-N metrics, merging counts from shards.
next: new - CodeMid
Merge overlapping intervals
DSAintervalsMerge all overlapping intervals. Backend tie-in: scheduling, calendar/booking conflicts, compacting time ranges.
next: new - CodeSenior
Topological sort (Kahn's algorithm)
DSAgraphOrder tasks so every dependency comes first; detect cycles. Backend tie-in: build/job DAGs, module init order, dependency resolution, deadlock detection.
next: new - CodeJunior
Two Sum (hashmap)
DSAhashmapReturn indices of two numbers that add to a target. Backend tie-in: the hashmap-for-O(1)-lookup instinct behind dedup, joins, and caching.
next: new - CodeMid
BFS shortest path on a grid
DSAgraphBFSFind the shortest path length from top-left to bottom-right in a 0/1 grid (0 = open). Backend tie-in: graph traversal for recommendations, routing, and reachability.
next: new - CodeMid
Implement debounce and throttle
DSAJSutilityImplement
debounce(fn, ms)(fire after quiet period) andthrottle(fn, ms)(at most once per interval). Backend tie-in: rate-limiting calls, coalescing bursts, batching writes.next: new - CodeJunior
Valid parentheses (stack)
DSAstackValidate that brackets
()[]{}are balanced and correctly nested. Backend tie-in: parsing, tokenizing, expression evaluation.next: new - CodeSenior
Merge K sorted lists/streams
DSAheapMerge K sorted sequences into one sorted output. Backend tie-in: merging sorted results from K database shards or K ordered partitions.
next: new - CodeSenior
Sliding-window request counter
DSAqueuerate limitingImplement a counter that reports how many requests happened in the last
Wms. Backend tie-in: the data structure inside a sliding-window rate limiter.next: new - DesignSenior
Debug: an endpoint's latency just spiked
performancedebuggingp99 latency on one endpoint jumped from 80ms to 2s. You have logs, metrics, and traces. Walk through how you find and fix the cause.
next: new - CodeSenior
Debug: memory grows until the pod is OOM-killed
performancememoryRSS climbs steadily over hours until k8s OOM-kills the pod. How do you find the leak?
next: new - CodeSenior
Optimize: an endpoint runs hundreds of queries
performancedatabaseA list endpoint that returns 100 orders fires ~400 queries. Diagnose and fix it.
next: new - CodeSenior
Make a CPU-bound endpoint non-blocking
performanceworker_threadsAn endpoint generates a PDF / resizes an image synchronously and tanks throughput under load. Make it non-blocking.
next: new - DesignSenior
Profile and fix slow startup / cold start
performancestartupThe service takes 8s to become ready, hurting deploys and serverless cold starts. How do you cut it?
next: new