Browse concepts
the sliding window technique
The sliding window technique solves array and string problems by maintaining a moving range instead of recomputing from scratch.
the two pointers technique
The two pointers technique uses two indices moving through a structure to solve pair, partition, and in-place problems efficiently.
binary search
Binary search finds a target in sorted data in O(log n) by repeatedly halving the search range.
dynamic programming
Dynamic programming solves problems by breaking them into overlapping subproblems and reusing stored results.
recursion and backtracking
Recursion solves problems by self-reference; backtracking explores choices and undoes them when they fail.
breadth-first search (BFS)
Breadth-first search explores a graph level by level using a queue, finding shortest paths in unweighted graphs.
depth-first search (DFS)
Depth-first search explores a graph as deep as possible before backtracking, using recursion or a stack.
a hash map
A hash map stores key-value pairs with average O(1) lookup by hashing keys into buckets.
heaps and priority queues
A heap is a tree-based structure that gives fast access to the min or max; a priority queue is often built on one.
a graph in interviews
A graph models entities and relationships as nodes and edges, underlying traversal, shortest-path, and connectivity problems.
trees and binary search trees
Trees are hierarchical structures; a binary search tree keeps sorted order for O(log n) search when balanced.
Big O notation
Big O notation describes how an algorithm scales in time or space as input size grows.
linked lists
A linked list stores elements in nodes that point to the next node, giving fast inserts and deletes without shifting elements.
stacks and queues
A stack is last-in first-out and a queue is first-in first-out; both are core structures behind traversal, parsing, and scheduling.
the main sorting algorithms
Comparison sorts like quicksort and merge sort run in O(n log n), while counting and radix sort can reach linear time on bounded keys.
greedy algorithms
A greedy algorithm makes the locally optimal choice at each step, which reaches a global optimum only when the problem has the right structure.
a trie (prefix tree)
A trie stores strings by shared prefixes, giving fast prefix search for autocomplete, spell check, and dictionary lookups.
Union-Find (disjoint set union)
Union-Find tracks elements split into disjoint sets and answers connectivity queries fast, powering cycle detection and Kruskal's algorithm.
bit manipulation
Bit manipulation uses bitwise operators to test, set, and toggle individual bits for compact, fast solutions to many interview problems.
topological sort
Topological sort orders a directed acyclic graph so every edge points forward, used for build order and dependency resolution.
Dijkstra's algorithm
Dijkstra's algorithm finds shortest paths from a source to all nodes in a graph with non-negative edge weights using a priority queue.
a monotonic stack
A monotonic stack keeps its elements in sorted order to solve next-greater-element and range problems in linear time.
prefix sums
A prefix sum array precomputes running totals so any range sum can be answered in constant time after linear preprocessing.
divide and conquer
Divide and conquer splits a problem into independent subproblems, solves them recursively, and combines the results, as in merge sort.
consistent hashing
Consistent hashing distributes keys across servers so that adding or removing a node moves few keys.
the CAP theorem
The CAP theorem says a distributed system can guarantee only two of consistency, availability, and partition tolerance during a partition.
load balancing
Load balancing spreads traffic across multiple servers to improve throughput, availability, and reliability.
caching
Caching stores frequently used data close to consumers to reduce latency and load on the source.
database sharding
Sharding splits a database horizontally across servers so each holds a subset of the data.
a message queue
A message queue decouples producers and consumers by buffering messages for asynchronous processing.
rate limiting
Rate limiting caps how many requests a client can make in a time window to protect a service.
database indexing
A database index is a data structure that speeds up reads at the cost of extra storage and slower writes.
a microservices architecture
Microservices split an application into small, independently deployable services that communicate over the network, trading simplicity for scale.
an API gateway
An API gateway is a single entry point that routes requests to backend services and handles auth, rate limiting, and response aggregation.
a CDN (content delivery network)
A CDN caches content on edge servers close to users worldwide, cutting latency and offloading traffic from the origin server.
database replication
Replication keeps copies of a database on multiple servers to improve availability, read scaling, and durability.
ACID properties
ACID stands for atomicity, consistency, isolation, and durability, the guarantees that keep database transactions reliable.
eventual consistency
Eventual consistency means replicas converge to the same value over time, trading immediate consistency for availability and low latency.
idempotency
An idempotent operation gives the same result whether it runs once or many times, which makes safe retries possible in distributed systems.
WebSockets
WebSockets keep a persistent two-way connection open between client and server, enabling real-time features like chat and live updates.
a Bloom filter
A Bloom filter is a compact probabilistic structure that tests set membership with no false negatives but possible false positives.
the difference between SQL and NoSQL
SQL databases use structured tables and strong consistency; NoSQL databases trade schema and joins for flexible models and horizontal scale.
Horizontal vs vertical scaling
Vertical scaling adds power to one machine; horizontal scaling adds more machines. Each has different limits, cost, and complexity.
the circuit breaker pattern
A circuit breaker stops calls to a failing service for a while, preventing cascading failures and giving it time to recover.
leader election in distributed systems
Leader election selects one node to coordinate work in a distributed system while handling failures, stale leaders, and split-brain risk.
How do distributed locks work
Distributed locks coordinate exclusive work across nodes using leases, ownership tokens, and fencing to remain safe during failures.
quorum reads and writes
Quorum reads and writes use overlapping replica majorities to balance consistency, availability, and latency in distributed storage.
service discovery
Service discovery lets changing service instances register, find one another, pass health checks, and receive traffic without fixed addresses.
How do health checks work in distributed systems
Health checks distinguish process liveness from traffic readiness so orchestrators and load balancers can recover services safely.
backpressure in distributed systems
Backpressure keeps fast producers from overwhelming slower consumers by slowing, buffering, shedding, or rejecting incoming work.
the bulkhead pattern
The bulkhead pattern isolates resources by workload so a failure or traffic surge in one area cannot exhaust an entire service.
How does exponential backoff work
Exponential backoff spaces retries farther apart and adds jitter to avoid synchronized retry storms during transient failures.
the saga pattern
The saga pattern coordinates a distributed business transaction as local steps with compensating actions for partial failure.
the transactional outbox pattern
A transactional outbox stores a state change and its event together, then publishes the event asynchronously without a dual-write gap.
change data capture
Change data capture streams committed database changes to downstream systems without repeated full-table scans or fragile dual writes.
event sourcing
Event sourcing stores immutable domain events as the source of truth and rebuilds current state by replaying them into projections.
CQRS
CQRS separates command and query models so writes can enforce domain rules while reads use independently optimized projections.
a write-ahead log
A write-ahead log records durable changes before data pages are modified, enabling crash recovery, replication, and efficient batched writes.
a log-structured merge tree
An LSM tree turns random writes into sequential batches across memory and sorted disk levels, trading read and compaction work for write throughput.
How do B-trees and LSM trees differ
B-trees update balanced pages in place; LSM trees batch writes into sorted runs. The right choice depends on reads, writes, and storage behavior.
How do read replicas work
Read replicas copy data from a primary database to scale queries and improve resilience, with explicit lag and consistency tradeoffs.
database connection pooling
A database connection pool reuses a bounded set of established connections, reducing setup cost while protecting the database from overload.
How do cache eviction policies work
Cache eviction policies choose which entries to remove under a memory limit using recency, frequency, age, size, and workload cost.
How do webhooks work
Webhooks deliver event notifications to subscriber endpoints with signatures, retries, deduplication, ordering, and replay controls.