// interview
Interviews
Real interview questions answered by walking what actually executes — the trace as the answer, pitfalls included.
- 01cloud internalsExplain the difference between Kubernetes `requests` and `limits` for both CPU (`cpu.weight` vs `cpu.max` CFS quota) and Memory (`memory.min/low` +.Contrast compressible CPU (throttled via CFS `cpu.max` every 100 ms) with incompressible Memory (killed with `SIGKILL` 137 on `memory.max`), trace why old runtimes read `/proc/cpuinfo` (64 host cores) instead of cgroup limits, and explain Kubernetes QoS classes (`Guaranteed`, `Burstable`, `BestEffort`).easyApplicationOct 22, 2026
- 02cloud internalsExplain how the Linux Kernel eBPF architecture works from start to finish: `bpf()` syscall loading, the Static Verifier (`data_end` pointer tracking &.Contrast eBPF with `.ko` kernel modules, explain why `XDP` beats `iptables` by running before `sk_buff` allocation, explain `BPF_MAP_TYPE_PERCPU_HASH` for lock-free metrics, and show how `Tetragon` correlates kernel `task_struct` cgroup IDs with Kubernetes Pod metadata.mediumApplicationOct 22, 2026
- 03cloud internalsTrace what happens inside `kube-apiserver` and `etcd` when you run `kubectl apply -f deployment.yaml`. Explain `etcd`'s MVCC `ModRevision`.Walk through Authentication -> Authorization (RBAC) -> Mutating Admission Webhooks -> Schema Validation -> Validating Admission Webhooks -> `etcd` Raft MVCC transaction -> `WatchCache` fan-out to Informers.mediumApplicationOct 22, 2026
- 04cloud internalsDraw the full architecture of a Kubernetes Controller / Operator using `client-go` (`Reflector`, `DeltaFIFO`, `SharedInformer`, `Indexer`.Trace the 6 components in `sample-controller`, explain the `dirty`/`processing` workqueue sets, contrast in-cluster garbage collection (`ownerReferences`) with external cleanup (`finalizers`), and explain why mutating `Indexer` pointers corrupts shared memory.mediumApplicationOct 22, 2026
- 05cloud internalsExplain how a Kubernetes `ClusterIP` Service works under the hood in `iptables` mode, `IPVS` mode, and `eBPF` (`Cilium`) mode. Then explain the.Compare $O(N)$ `iptables` rule chains vs $O(1)$ `IPVS` hash tables vs $O(1)$ eBPF `cgroup/connect4` socket rewriting, and trace the parallel timeline of `Pod Deletion -> SIGTERM` vs `EndpointSlice -> kube-proxy / Ingress update`.mediumApplicationOct 22, 2026
- 06cloud internalsWhen someone runs `docker run` or Kubernetes schedules a Pod, explain the exact sequence of Linux kernel syscalls and namespaces (`clone`/`unshare`, `pid`.List the 7 Linux namespaces, trace `clone()` + `pivot_root` + `umount2(MNT_DETACH)`, explain why `PID 1` ignores unhandled `SIGTERM` and must reap orphaned `SIGCHLD` zombies, and explain how Kubernetes pods share `net`/`ipc`/`uts` namespaces via the `pause` infra container.easyApplicationOct 22, 2026
- 07cloud internalsWalk through how `kube-scheduler` schedules a Pod (`PreFilter -> Filter -> PostFilter/Preemption -> Score -> Reserve -> Permit -> Bind`). How do you combine.Explain the synchronous Scheduling Cycle (`AssumePod` in `Reserve`) vs asynchronous Binding Cycle, contrast `podAntiAffinity` (hard 1-per-node limit) vs `topologySpreadConstraints` (`maxSkew`), and pair multi-AZ spreading with `PDB` (`maxUnavailable: 1`).easyApplicationOct 22, 2026
- 08cloud internalsTrace the exact journey of a TCP packet from `Container A` (`10.244.1.5`) to `Container B` (`10.244.2.9`) on a different Kubernetes node under both a `VXLAN`.Walk through Pod NetNS `eth0` -> `veth` pair -> Host NetNS `cni0` bridge -> routing table -> `vxlan0` UDP 8472 encapsulation -> physical `eth0` -> remote `vxlan0` decapsulation, and explain AWS VPC ENI secondary IP exhaustion.easyApplicationOct 22, 2026
- 09databasesWhy do databases use B+ Trees instead of Binary Search Trees or B-Trees (where internal nodes also store row payloads)? Explain the exact hardware and WAL.Calculate internal node fan-out ($B \approx 500$ because internal nodes omit row payloads!), trace leaf doubly-linked sibling pointers for range scans, and contrast `UUIDv4` midpoint splits + WAL Full-Page Writes with `UUIDv7`'s 48-bit timestamp prefix.easyApplicationOct 22, 2026
- 10databasesWhy should you use the Database Buffer Pool instead of relying solely on the Linux OS Page Cache (`mmap`), how does Clock-Sweep / LRU-K prevent Sequential.Explain why `mmap` cannot prevent the OS from flushing a dirty page to disk before its WAL record is `fsync`ed (violating ARIES crash recovery!), trace Clock-Sweep vs LRU-K, and explain PostgreSQL's 256 KB ring buffer.mediumApplicationOct 22, 2026
- 11databasesWhy is a Columnar Vectorized engine (DuckDB / ClickHouse / Snowflake over Parquet) 100x–1,000x faster than a Row-Oriented OLTP engine (PostgreSQL / MySQL) for.Explain Row (`NSM`) vs Column (`DSM` / `PAX` Parquet Row Groups) physical layout, Zone Map (`min`/`max`) pruning, Dictionary + RLE compression, Late Materialization, and why `2,048`-row Vectorized execution fits L1 cache and SIMD registers.easyApplicationOct 22, 2026
- 12databasesWalk through how you diagnose a slow SQL query using `EXPLAIN (ANALYZE, BUFFERS)`. Explain the Equality-Before-Range rule for composite B+ Tree indexes.Explain `loops`, `rows removed by filter`, and `Buffers: shared hit/read`, contrast `OFFSET N` ($O(N)$ scan-and-discard) with Keyset Pagination (`WHERE (created_at, id) < ($last_ts, $last_id) LIMIT 50` in $O(\log N)$), and show how Partial Indexes shrink index size by 99%.easyApplicationOct 22, 2026
- 13databasesExplain the hierarchy of SQL Isolation Levels (`READ COMMITTED`, `REPEATABLE READ` / Snapshot Isolation, and `SERIALIZABLE` / SSI) with concrete examples of.Write out the Lost Update and On-Call Doctor Write Skew interleavings, show how `SELECT ... FOR UPDATE`, atomic `UPDATE ... SET bal = bal - $1 WHERE bal >= $1`, or `SERIALIZABLE` (with `40001` retry loops) solve them, and trace `STEAL/NO-FORCE` ARIES recovery.mediumApplicationOct 22, 2026
- 14databasesCompare a B+ Tree storage engine (PostgreSQL / InnoDB) against an LSM-Tree storage engine (RocksDB / Cassandra) across Write Amplification, Read.Walk through the RUM Conjecture, contrast B+ Tree in-place 8 KB random page writes with LSM sequential SSTable flushes, prove why Bloom filters have 0% false negatives, and diagnose the LSM Tombstone range-scan anti-pattern.easyApplicationOct 22, 2026
- 15databasesCompare how PostgreSQL (append-only tuple versions in heap + `xmin`/`xmax` + `VACUUM` + HOT updates) and MySQL InnoDB (in-place clustered index updates + Undo.Contrast PostgreSQL fast historical reads + `VACUUM`/bloat/write-amplification on indexed updates against InnoDB's clean in-place updates + expensive Undo Log chain reconstruction on long historical reads and slow rollbacks of huge transactions.mediumApplicationOct 22, 2026
- 16databasesDraw the internal layout of an 8 KB PostgreSQL Slotted Page (`PageHeader`, `ItemIdData` line pointers, free space, `HeapTupleHeader`, null bitmap, aligned.Explain why line pointers grow down while tuples grow up, how `HeapTupleHeader` costs 23 bytes per row, how `NULL` columns occupy 0 data bytes via the null bitmap, and why `SELECT *` on tables with TOASTed columns hurts I/O.easyApplicationOct 22, 2026
- 17languageWalk through the internal structure of a Go channel (`hchan`), explain the exact table of channel state behaviors (nil vs open vs closed for send, receive.Detail `hchan` (`buf`, `sendx`, `recvx`, `sendq`, `recvq`, `lock`), `sendDirect` stack-to-stack copy, the nil/open/closed matrix, and buffered (`cap=1`) vs `select`+`ctx.Done()` fixes.easyApplicationOct 22, 2026
- 18languageHow does Go's compiler decide whether a variable is allocated on the stack or the heap (Escape Analysis), why is returning a value `User` often faster than.Explain downward pointer sharing (stack-safe) vs upward pointer returning (heap-escape), inspect `-gcflags=-m`, and trace `Unwrap()` trees in `errors.Is`/`As`.easyApplicationOct 22, 2026
- 19languageExplain how Go's Concurrent Tri-Color Mark-and-Sweep GC works—why doesn't Go use a compacting/generational GC like the JVM, how does the Hybrid Write Barrier.Explain value types + escape analysis + size-class `mspan` allocators (why compaction isn't needed), trace White/Grey/Black + Hybrid Write Barrier, and detail the `GOMEMLIMIT` (~90% of container memory) production formula.easyApplicationOct 22, 2026
- 20languageExplain the Go GMP scheduler in detail—what are G, M, and P, what is the `runnext` slot, how does work-stealing work, how does the Netpoller differ from.Walk through `G`, `M`, `P`, the 1-slot LIFO `runnext` optimization, `schedtick % 61` global fairness, 50% work-stealing, `epoll` Netpoller vs `handoffp`, and Kubernetes CFS quota throttling.easyApplicationOct 22, 2026
- 21languageExplain how interfaces are represented in the Go runtime (`iface` vs `eface` and the `itab` table), why returning a `nil` concrete pointer as `error` breaks.Trace the 16-byte `(tab, data)` struct, explain `itab` hash-table lookup on interface conversion, and contrast `[]T`'s contiguous memory layout against `[]any`'s array of 16-byte `eface` structs.easyApplicationOct 22, 2026
- 22languageExplain how Go maps work internally (`hmap`, `bmap` `[8]tophash`/`[8]K`/`[8]V`, incremental evacuation, and Go 1.24 SwissTables)—why is map iteration order.Walk through bucket layout, incremental `growWork`, why `delete` doesn't shrink buckets, why `fatal error` bypasses `recover()`, and `sync.Map` vs sharded `RWMutex`.easyApplicationOct 22, 2026
- 23languageHow does `sync.Pool` avoid lock contention across 64 CPU cores, why did Go 1.13 add a 'victim cache' to `sync.Pool`, and how do you combine `sync.Pool` and.Explain per-`P` `poolLocal` private slots + lock-free `poolChain` ring buffers, the 2-GC-cycle `victim` cache that smooths allocation spikes after GC, and `singleflight` context detachment.easyApplicationOct 22, 2026
- 24languageHow does `select` work inside the Go runtime (`pollorder` and `lockorder`), how does `context.Context` propagate cancellation across goroutines in $O(1)$, and.Explain `selectgo`'s random poll permutation and address-sorted locking, `close(done)` broadcast semantics, and `errgroup.WithContext` scoping.easyApplicationOct 22, 2026
- 25languageExplain Go's 24-byte slice header—when does `append` mutate an existing slice's backing array, how can slicing cause a 100 MB memory leak in Go, and how do.Trace `(ptr, len, cap)`, `growslice` growth thresholds, backing-array retention leaks on small sub-slices, and three-index slicing `s[i:j:k]`.easyApplicationOct 22, 2026
- 26languageHow are strings represented in memory in Go, why does `s[i]` return a `byte` while `for _, r := range s` yields a `rune`, when does `string(byteSlice)` avoid.Explain the 16-byte `(ptr, len)` string header, UTF-8 byte vs rune indexing, compiler zero-copy optimizations for `m[string(b)]`, and `strings.Builder` + `Grow()`.easyApplicationOct 22, 2026
- 27languageWalk through what happens under the hood when an `asyncio` coroutine executes `await client.get(url)`—how do Coroutines, Futures, Tasks, and `epoll` interact.Trace `Task.__step()` calling `coro.send(None)`, yielding a `Future` up the `await` chain, `loop.add_reader(fd)` on `epoll`, `Task.__wakeup`, and `asyncio.to_thread` / `ProcessPoolExecutor`.easyApplicationOct 22, 2026
- 28languageHow does the `asyncio` event loop actually work under the hood (coroutines, `Future`, `Task._step()`, `epoll`/`kqueue`), when do you still need `asyncio.Lock`.Trace `Task._step()` driving `coro.send(None)`, explain read-modify-write races across `await` points, and use `loop.set_debug(True)` / lag monitors.easyApplicationOct 22, 2026
- 29languageDo Python type hints (`def f(x: int) -> int:`) make CPython run faster? Explain how CPython's bytecode evaluation loop and PEP 659 Adaptive Specialization.Clarify that static annotations do not speed up CPython directly, but runtime type stability triggers PEP 659 inline caches (`BINARY_OP_ADD_INT`, `LOAD_ATTR_SLOT`, `CALL_PY_EXACT_ARGS`).easyApplicationOct 22, 2026
- 30languageWalk through how you diagnose and optimize a slow Python service in production—from profiling (`py-spy` / `tracemalloc`), to algorithmic/data-structure fixes.Synthesize sampling vs deterministic profiling, Python-level optimizations (`dict`/`deque`/`__slots__`/`memoryview`), and zero-copy `Py_buffer` + `allow_threads` FFI boundary design.easyApplicationOct 22, 2026
- 31languageExplain how closures work at the bytecode/memory level in CPython (`PyCellObject`, `LOAD_DEREF`, `nonlocal`), why lambdas in a loop all see the final loop.Trace `co_freevars`, `co_cellvars`, `__closure__`, `UnboundLocalError`, and 3-layer parameterized decorators `def retry(max_attempts):`.easyApplicationOct 22, 2026
- 32languageHow does the Descriptor Protocol power methods (`self`), `@property`, and `@functools.cached_property` in Python—and why is `@cached_property` a Non-Data.Walk through the 3-step `object.__getattribute__` algorithm, explain how functions bind `self` via `__get__`, and trace why `@cached_property` omits `__set__` so `obj.__dict__` shadows it on subsequent reads.easyApplicationOct 22, 2026
- 33languageWhy does `threading.local()` cause cross-request data leaks in `asyncio` applications, how does `contextvars.ContextVar` work under the hood (HAMT + `Token`).Explain single-thread multiplexing in `asyncio`, `Python/hamt.c` persistent tries, `var.set()`/`var.reset(token)`, and `contextvars.copy_context().run(...)`.easyApplicationOct 22, 2026
- 34languageWhy does `threading.local()` break in `asyncio`, how does `contextvars` use a persistent HAMT to achieve O(1) context copying across `create_task()`, and what.Contrast OS-thread-bound storage with `Task._step()` context swapping, explain HAMT structural sharing, and show `token = var.set()` / `var.reset(token)`.easyApplicationOct 22, 2026
- 35languageCompare `@dataclass(slots=True, frozen=True)`, `NamedTuple`, `TypedDict`, and Pydantic `BaseModel`—how do their memory layouts, instantiation speeds, and.Contrast C-slot structs (`dataclass(slots=True)`), tuple subclasses (`NamedTuple`), static-only dicts (`TypedDict`), and Rust-backed boundary validators (Pydantic v2 / `msgspec`).easyApplicationOct 22, 2026
- 36languageWhat does the CPython GIL actually protect, when is it released, why isn't `x += 1` thread-safe under the GIL, and how does PEP 703 (Python 3.13t/3.14t).Detail `ob_refcnt` and `pymalloc` protection, `eval_breaker` 5-ms switching, `Py_BEGIN_ALLOW_THREADS`, and PEP 703's trio: Immortal Objects, Biased Reference Counting, and `mimalloc`.easyApplicationOct 22, 2026
- 37languageWhat is the exact difference between an Iterable and an Iterator in Python, how does a generator preserve local variables across `yield` without using the C.Contrast `__iter__` (Iterable) with `__iter__ + __next__` (Iterator), explain heap-allocated `PyFrameObject` suspension, and trace `yield` + `finally` cleanup in context managers / dependencies.easyApplicationOct 22, 2026
- 38languageHow are `list` and `dict` implemented inside CPython, why is `dict` ordered since Python 3.7, and how do Key-Sharing Dicts (PEP 412) and `__slots__` save.Walk through `PyListObject`'s `ob_item` pointer array, `PyDictObject`'s split `indices` + `entries` tables, and instance `__dict__` vs `__slots__`.mediumApplicationOct 22, 2026
- 39languageHow do you parallelize CPU-bound work across 8 cores in Python without getting killed by `pickle` IPC overhead or `fork()` multithreaded deadlocks?Compare `fork`, `spawn`, and `forkserver`, explain `ProcessPoolExecutor(initializer=...)` vs `SharedMemory` + `numpy.ndarray(buffer=shm.buf)`, and detail `/dev/shm` cleanup via `SharedMemoryManager`.easyApplicationOct 22, 2026
- 40languageExplain why mutable default arguments and `[[0]*N]*M` fail in Python, why `if not bucket:` is a subtle bug compared to `if bucket is None:`, and how.Trace `fn.__defaults__`, distinguish falsy empty lists `[]` from `None`, and explain `deepcopy`'s `memo` cycle-detection dictionary.easyApplicationOct 22, 2026
- 41languageWhat is inside a CPython PyObject in memory, how does `b = a` work under the hood, and why does `1000 is 1000` behave differently in a script vs the REPL?Explain the 16-byte PyObject header (ob_refcnt, ob_type), small-integer interning [-5, 256], compiler constant folding per code object, and PEP 683 immortal objects.easyApplicationOct 22, 2026
- 42languageExplain the semantics and traps of Python's `match / case` (bare capture names vs dotted constants, mapping vs sequence matching, `__match_args__`) and how.Detail PEP 634 bytecode lowering, the bare-name capture trap, `bool` subclassing `int`, and PEP 654 `ExceptionGroup` tree partitioning.easyApplicationOct 22, 2026
- 43languageWhy is `list[T]` invariant while `Sequence[T]` is covariant, how does `Callable[[Arg], Ret]` variance work (contravariant in arguments, covariant in return).Explain Liskov Substitution Principle on mutable vs immutable containers, function argument contravariance, and structural vs nominal subtyping.easyApplicationOct 22, 2026
- 44languageA production Python service loads 2 GB of data, processes it, deletes all references, and runs `gc.collect()`, yet Kubernetes still reports 1.8 GB of memory.Explain `pymalloc`'s 512B threshold, 4 KB Pools, and 256 KB Arenas, distinguish reusable free-list fragmentation from unbounded reference leaks via `tracemalloc.take_snapshot()`, and give production remedies.easyApplicationOct 22, 2026
- 45languageExplain how CPython manages memory using both Reference Counting and the 3-Generation Cyclic Garbage Collector—how does Trial Deletion work, and why did.Walk through `ob_refcnt` immediate deallocation, `PyGC_Head` doubly linked lists across Generations 0/1/2, trial deletion (`gc_refs`), and Copy-on-Write page faults on `fork()`.mediumApplicationOct 22, 2026
- 46languageWhy is `asyncio.TaskGroup` preferred over `asyncio.gather` in modern Python (3.11+), how does `except*` handle `ExceptionGroup`, and how do you apply.Contrast `gather`'s orphaned tasks with `TaskGroup`'s scoped cancellation and `finally` joining, explain `except* ValueError as eg:`, and compare `Semaphore` vs bounded `Queue` worker pools.easyApplicationOct 22, 2026
- 47languageCompare `asyncio.TaskGroup` with `asyncio.gather`, explain the 'disappearing task' bug with `asyncio.create_task()`, and show how to protect a critical.Contrast unstructured `gather` vs structured `TaskGroup`, explain weak-ref task collection, and trace `CancelledError` propagation + `asyncio.timeout()`.easyApplicationOct 22, 2026
- 48languageExplain how `async fn` compiles into a state machine in Rust, why self-referential futures require `Pin<&mut Self>`, how stack pinning (`std::pin::pin!`).Trace the compiler-generated `enum` across `.await` yield points, `Pin` / `Unpin`, `Waker` readiness notifications, and `tokio::select!` drop cancellation.mediumApplicationOct 22, 2026
- 49languageExplain how Rust's borrow checker (`&T` XOR `&mut T`), Lifetime annotations (`fn longest<'a>(x: &'a str, y: &'a str) -> &'a str`), and disjoint field.Explain lifetime variance/intersection (`'a` is the smaller of the two input lifetimes), struct field borrow splitting, and why `split_at_mut` encapsulates an internal `unsafe` bounds-checked pointer split.easyApplicationOct 22, 2026
- 50languageWhat are the exact rules for writing sound `unsafe` Rust (aliasing, alignment, `MaybeUninit`, `catch_unwind` across FFI), how does `cargo miri` detect.Detail the 5 `unsafe` operations, Stacked/Tree Borrows in `Miri`, `MaybeUninit`T``, `extern "C-unwind"` panic safety, and C11/Rust memory orderings.mediumApplicationOct 22, 2026
- 51languageHow are Rust enums laid out in memory (tagged unions + niche optimization), why does a large `Err` variant hurt `Ok` performance in `Result<T, E>`, and how.Explain union sizing (`max(variants) + tag`), `NonZero*` / `NonNull` niches, `Box<LargeError>` to shrink `Result`, and why `?` avoids DWARF stack unwinding.easyApplicationOct 22, 2026
- 52languageExplain how Rust's Ownership, Move semantics, and `Drop` eliminate both garbage-collection pauses and C/C++ use-after-free/double-free bugs—and how Rust's.Trace the 24-byte `Vec`/`String` stack header, mutually exclusive `Copy` vs `Drop`, conditional move drop flags on the stack, and `mem::take` / `mem::replace`.easyApplicationOct 22, 2026
- 53languageExplain how `Send`, `Sync`, and `UnsafeCell`T`` work together in Rust—why is `RefCell`T`` `Send` but `!Sync`, why is `Rc`T`` both `!Send` and `!Sync`, and how.Prove why `RefCell` is `Send + !Sync`, why `Rc` is `!Send + !Sync`, why `Mutex`T`` owns `T` inside the lock, and when `std::sync::Mutex` is faster than `tokio::sync::Mutex`.easyApplicationOct 22, 2026
- 54languageContrast static dispatch (`impl Trait` / `<T: Trait>`) and dynamic dispatch (`&dyn Trait` / `Box<dyn Trait>`) in Rust—how is a Rust vtable laid out, what are.Explain monomorphization + LLVM inlining, the 16-byte `(data_ptr, vtable_ptr)` fat pointer, `where Self: Sized` escape hatches on object-safe traits, and the inner non-generic function idiom.easyApplicationOct 22, 2026
- 55languageExplain how to implement Zero-Cost Branded Types in TypeScript, how distributive conditional types and `infer` work (e.g., implementing `Awaited<T>` or.Write the `Brand<T, B>` phantom symbol intersection, implement recursive `MyAwaited<T>` with `infer U`, and contrast method bivariance with function-property contravariance.mediumApplicationOct 22, 2026
- 56languageExplain V8 Hidden Classes (Shapes/Maps) and Inline Caches (Monomorphic, Polymorphic, Megamorphic). Why doesn't a TypeScript `interface` automatically.Walk through in-object property offsets, Map transition trees, the 4-shape polymorphic threshold, `delete` dictionary degradation, and why TypeScript type erasure leaves runtime property order in control.easyApplicationOct 22, 2026
- 57languageExplain the exact execution order of the Call Stack, `process.nextTick`, the V8 Promise Microtask Queue, `setTimeout(fn, 0)`, and `setImmediate(fn)` in.Diagram the 6 `libuv` phases, explain why `nextTick` and Promise microtasks run between every phase callback, show how `perf_hooks.monitorEventLoopDelay()` measures P99 lag, and fix microtask starvation with time-budgeted `setImmediate` yields.easyApplicationOct 22, 2026
- 58languageImplement a bounded concurrency runner `mapWithConcurrency(items, limit, signal, worker)` in TypeScript that maintains at most `limit` in-flight tasks without.Write the pull-based `nextIndex++` coroutine lane pattern, compose `AbortSignal.any([parentSignal, poolController.signal])`, and explain why `nextIndex++` has no race condition on a single JS thread.mediumApplicationOct 22, 2026
- 59languageHow does stream backpressure work under the hood in Node.js (`highWaterMark`, `write() -> false`, `'drain'`, `pipeline`), and how can `Buffer.subarray()` both.Walk through the producer/consumer `highWaterMark` state machine, why `.pipe()` leaks file descriptors on client disconnect, `DataView` `byteOffset` bugs on Node's 8 KB slab allocator, and slab retention in LRU caches.mediumApplicationOct 22, 2026
- 60languageHow do Discriminated Unions and `assertNever(x: never)` eliminate illegal runtime states in TypeScript, and why should every external boundary (`JSON.parse`.Explain set-theoretic narrowing, making illegal states unrepresentable, why `any` infects the call graph by disabling type checking, and how schema validators (Zod/Valibot) narrow `unknown` into typed discriminated unions.easyApplicationOct 22, 2026
- 61languageExplain how V8's Orinoco Garbage Collector (NewSpace Semi-Space Scavenger vs OldSpace Mark-Sweep-Compact, Write Barriers, and Remembered Sets) and Array.Contrast $O(\text{live})$ NewSpace copying with OldSpace concurrent marking, explain Old-to-New Write Barriers, trace premature promotion when request latency exceeds 2 scavenge intervals, and explain why `TypedArray` Structure-of-Arrays bypasses GC scanning.mediumApplicationOct 22, 2026
- 62languageDesign a zero-copy multi-core worker pool in TypeScript/Node.js using `worker_threads`. Compare Structured Clone (`postMessage(obj)`), Transferables.Explain V8 Isolate memory separation, why `postMessage(obj)` bottlenecks the main thread, ping-pong double buffering with Transferables, and how `Atomics.store`/`load` prevent ARM64 memory reordering in a `SharedArrayBuffer` ring.hardApplicationOct 22, 2026
- 63system designDesign a distributed caching tier for 10 million QPS. Explain how Virtual-Node Consistent Hashing avoids rehashing storms, and compare 3 ways to prevent Cache.Walk through the $2^{32}$ hash ring with virtual nodes, the Cache-Aside stale-set race and Lease fix, and client-side L1 micro-caching (1–2s TTL) or key-salting (`key#0 .. key#9`) for single-key hot spots.mediumApplicationOct 22, 2026
- 64system designDesign a distributed rate limiter handling 1,000,000 requests/sec across 100 API Gateway nodes. Compare Token Bucket, Fixed Window, Sliding Window Log, and.Compare memory/accuracy tradeoffs across the 4 algorithms, detail the atomic Redis `TIME` + `HMGET`/`HMSET` Lua script, explain standard HTTP `429 Too Many Requests` headers (`Retry-After`, `X-RateLimit-Remaining`), and scale past 100k QPS via Redis Cluster hash-slot sharding + local gateway batching.easyApplicationOct 22, 2026
- 65system designCompare Two-Phase Commit (2PC) vs Saga (Choreography vs Orchestration) for a multi-service checkout or payment transfer. How do you handle Saga Lack of.Contrast 2PC lock-holding with Saga forward/backward recovery, structure Compensatable -> Pivot -> Retriable steps, apply Semantic Locks (`escrow` / `PENDING`), and compare Multi-Region Cell/Geo-Pinning vs Global Spanner/CockroachDB vs CRDTs.mediumApplicationOct 22, 2026
- 66system designExplain the Dual-Write Problem when updating a database and publishing to Kafka. How do the Transactional Outbox pattern, Kafka partition keys (`acks=all`.Walk through the failure modes of sequential DB + Kafka writes, compare Polling (`FOR UPDATE SKIP LOCKED`) vs WAL CDC (Debezium) outbox relays, explain Kafka ISR durability (`acks=all` + `min.insync.replicas=2`), and design an `Idempotency-Key` state machine.mediumApplicationOct 22, 2026
- 67system designCompare 3 architectures for a Multi-Region Active-Active system across US, EU, and APAC: (1) Home-Region Geo-Pinning with local Raft, (2) Global Distributed.Apply the PACELC theorem, trace why `2 * epsilon` clock uncertainty separates Spanner (`TrueTime` commit wait) from CockroachDB (HLC Read Restart within `max_offset`), and show how PN-Counters and OR-Sets avoid LWW lost updates.mediumApplicationOct 22, 2026
- 68system designDuring a 5x traffic spike, a microservice's CPU hits 100%, latency jumps from 15 ms to 8 seconds, and actual successful responses (Goodput) drop to 0 because.Explain FIFO queue saturation and Goodput collapse, derive Little's Law concurrency caps, contrast FIFO vs LIFO+CoDel under overload, propagate `grpc-timeout` / deadline headers to cancel expired work before DB queries, and shed by priority tier.hardApplicationOct 22, 2026
- 69system designExplain how Raft guarantees Leader Election safety and Log Matching across network partitions, why you should deploy 3 or 5 nodes instead of 4, and why.Walk through Raft `term` numbers, the `(lastLogTerm, lastLogIndex)` election restriction, why a leader only commits entries from its *current* term by counting replicas, and Martin Kleppmann's GC-pause Fencing Token proof.mediumApplicationOct 22, 2026
- 70system designExplain Tail Latency Amplification in microservice architectures ($1 - (1 - p)^N$). How do L4 vs L7 Load Balancers, Power-of-Two-Choices (P2C), and P95 Hedged.Derive the fan-out probability formula, explain why HTTP/2 and gRPC break L4 connection balancing, trace P2C least-request selection without global coordination, and bound hedged request overhead with a token bucket.easyApplicationOct 22, 2026
- 71languageWhen would you use an arena allocator instead of malloc?Explain arena allocation trade-offs: fast allocation, no per-object free, bulk deallocation, and fragmentation.mediumApplicationOct 21, 2026
- 72languageArrays versus pointers: are they the same?Explain that arrays and pointers are distinct types, though arrays often decay into pointers.easyApplicationOct 21, 2026
- 73languageWhat does AddressSanitizer detect that valgrind does not, and vice versa?Compare ASan's compile-time instrumentation (fast, detects use-after-free/overflow) versus valgrind's runtime emulation (slow, no recompile).mediumApplicationOct 21, 2026
- 74languageWhat makes a function async-signal-safe?Explain that async-signal-safe functions can be called from a signal handler, and list examples like write but not printf/malloc.mediumApplicationOct 21, 2026
- 75languageWhat is the difference between sequential consistency and acquire-release?Explain memory_order_seq_cst total ordering versus memory_order_acquire/release for synchronization without full ordering.mediumApplicationOct 21, 2026
- 76languageWhy does sequential array access outperform random access?Explain spatial locality, cache line prefetching, and how sequential access fills cache lines efficiently.easyApplicationOct 21, 2026
- 77languageWhat are deferred versus asynchronous cancellation?Explain deferred cancellation (cancellation points only) versus asynchronous (immediate, unsafe) and why deferred is preferred.mediumApplicationOct 21, 2026
- 78languageDesign a memory-safe collections library in C.Discuss API design, ownership semantics, error handling without exceptions, and testing strategies for a C collections library.hardApplicationOct 21, 2026
- 79languageWhat happens between typing gcc hello.c -o hello and seeing your program run?Explain the four stages of the C compilation pipeline — preprocessing, compilation, assembly, and linking — and what artifact each produces.easyApplicationOct 21, 2026
- 80languageHow do you tell a compiler error apart from a linker error in C, and what causes each?Distinguish syntax and type errors caught per translation unit by cc1 from unresolved or duplicate symbol errors caught across object files by ld.easyApplicationOct 21, 2026
- 81languageWhy must condition variable waits be in a predicate loop?Explain spurious wakeups and that waking does not guarantee the condition holds, so re-check in a while loop.easyApplicationOct 21, 2026
- 82languageWhat must be saved and restored during a manual context switch?Explain saving callee-saved registers, stack pointer, instruction pointer, and restoring them to resume execution.hardApplicationOct 21, 2026
- 83languageHow does cooperative I/O integrate with epoll?Explain yielding a coroutine on epoll_wait, registering interest, and resuming when the descriptor is ready.mediumApplicationOct 21, 2026
- 84languageDesign a full user-space coroutine runtime in C.Discuss stack management, context switching, M:N scheduling, cooperative I/O integration, and synchronization primitives.hardApplicationOct 21, 2026
- 85languageHow is a coroutine different from a thread?Explain cooperative (not preemptive) scheduling, single stack vs shared, and explicit yield/resume versus kernel scheduling.mediumApplicationOct 21, 2026
- 86languageHow do you prevent deadlock with multiple mutexes?Explain lock ordering (global hierarchy), try_lock backoff, and consistent acquisition order to break circular wait.mediumApplicationOct 21, 2026
- 87languageWhy does a function need a double pointer (T **) to allocate a buffer or replace the head of a linked list on behalf of its caller?Trace how passing T * by value only modifies the callee's local pointer copy, whereas passing T ** (&ptr) lets the callee dereference *out_ptr to update the caller's pointer.easyApplicationOct 21, 2026
- 88languageDynamic array versus linked list: when to use each?Compare amortized O(1) push-back for dynamic arrays versus O(1) insertion/deletion for linked lists, with cache locality trade-offs.mediumApplicationOct 21, 2026
- 89languageWhat is eBPF and how do kprobes/kretprobes work?Explain eBPF bytecode verified and run in the kernel, kprobes on function entry, kretprobes on exit, and user-space tools like bpftrace.mediumApplicationOct 21, 2026
- 90languageEnum versus #define constants: what is the difference?Explain how enum constants differ from macros in terms of type safety, scope, and debugger visibility.easyApplicationOct 21, 2026
- 91languageHow does epoll improve on select/poll?Explain O(1) event readiness notification, interest list in kernel, and edge-triggered versus level-triggered modes.mediumApplicationOct 21, 2026
- 92languageWhat is false sharing and how do you avoid it?Explain cache-line contention when threads modify different variables on the same line, and padding/alignment fixes.mediumApplicationOct 21, 2026
- 93languageHow does a fiber mutex avoid blocking the OS thread?Explain yielding the fiber (not the thread) and switching to another ready fiber, keeping the OS thread busy.mediumApplicationOct 21, 2026
- 94languageWhat is a file descriptor and how does the kernel use it?Explain file descriptors as indices into the per-process file descriptor table, referencing the open file description and inode.easyApplicationOct 21, 2026
- 95languageWhen should you use fixed-width integers like uint32_t and size_t instead of int, and how can mixing signed and unsigned types break comparisons?Explain platform data models (LP64 vs LLP64), why wire protocols and binary headers require <stdint.h> types, and how usual arithmetic conversions turn -1 > 1U true.easyApplicationOct 21, 2026
- 96languageWhat happens to the address space after fork?Explain copy-on-write duplication, shared file descriptors, and that the child gets a copy of the parent's memory.easyApplicationOct 21, 2026
- 97languageHow do function pointers work at the machine level, and how do C systems like the Linux kernel use struct vtables to implement polymorphism?Explain that a function name evaluates to its .text code address, trace indirect call instructions, and design an operations struct (vtable) for pluggable backends.easyApplicationOct 21, 2026
- 98languageFunctions versus macros: what is the difference?Explain how functions differ from preprocessor macros in type safety, evaluation, and debugging.easyApplicationOct 21, 2026
- 99languageWhy use getaddrinfo instead of gethostbyname?Explain protocol independence, IPv4/IPv6 dual-stack, thread safety, and struct addrinfo linked-list results.easyApplicationOct 21, 2026
- 100languageWhy use a guard page at the end of a stack?Explain stack overflow detection: accessing the guard page triggers SIGSEGV instead of silent corruption.easyApplicationOct 21, 2026
- 101languageHow do hard links and symbolic links differ?Explain hard links as additional directory entries to the same inode versus symlinks as separate files containing a path string.easyApplicationOct 21, 2026
- 102languageWhen building a command-line binary tool like xxd in C, why do we process 16-byte lines inside a 4 KB or 64 KB read buffer and guard printable ASCII checks?Explain how block buffering amortizes I/O overhead, how 16-byte rows align with hexadecimal offsets, and why unsigned char is required for byte formatting and isprint.easyApplicationOct 21, 2026
- 103languageDesign a high-throughput HTTP server in C.Discuss epoll event loop, thread pool for parsing, keep-alive, zero-copy file serving, and backpressure.hardApplicationOct 21, 2026
- 104languageWhy does order matter in an if/else if/else chain?Explain that only the first true condition executes, so higher-priority conditions must come first.easyApplicationOct 21, 2026
- 105languageWhy is longjmp unsafe with automatic variables?Explain that automatic variables modified between setjmp and longjmp become indeterminate unless declared volatile.mediumApplicationOct 21, 2026
- 106languageLoops versus recursion: when to use each?Explain the difference between iterative loops and recursive function calls, with trade-offs in simplicity and stack usage.easyApplicationOct 21, 2026
- 107languagemalloc versus calloc: what is the difference?Explain how calloc zero-initializes memory while malloc does not, and when to use each.easyApplicationOct 21, 2026
- 108languageWhat is a memory leak and how do you prevent it?Explain memory leaks, dangling pointers, and double frees, and how valgrind/ASan help detect them.easyApplicationOct 21, 2026
- 109languageWhen is mmap preferable to read/write for file I/O?Explain mmap advantages: random access, page-cache sharing, zero-copy, and when it is worse (small files, sequential access).mediumApplicationOct 21, 2026
- 110languageWhat is an M:N scheduler and why use work-stealing?Explain multiplexing N user threads onto M OS threads, work-stealing for load balancing, and reduced contention.hardApplicationOct 21, 2026
- 111languageHow is a 2D array int m[R][C] laid out in memory in C, why must a function parameter know the column count C, and how does loop order affect cache misses?Derive the row-major offset formula base + (r * C + c) * sizeof(int), explain why C is needed to stride between rows, and compare row-major vs column-major cache locality.easyApplicationOct 21, 2026
- 112languageWhy does NUMA affect memory access performance?Explain local versus remote node memory access, interconnect latency, and CPU pinning to reduce cross-socket traffic.mediumApplicationOct 21, 2026
- 113languageWhat is an opaque pointer and why use it?Explain how opaque pointers hide implementation details, reduce recompilation, and enforce encapsulation across translation units.mediumApplicationOct 21, 2026
- 114languageWhy must you handle partial reads and writes?Explain that read() and write() may transfer fewer bytes than requested and must be called in a loop until all data is transferred.easyApplicationOct 21, 2026
- 115languageHow do anonymous pipes coordinate parent-child communication?Explain pipe creation before fork, descriptor inheritance, closing unused ends, and EOF detection on read.easyApplicationOct 21, 2026
- 116languageWhat are hardware performance counters and what do they measure?Explain PMU counters for cycles, instructions, cache misses, branch misses, and how perf reads them.mediumApplicationOct 21, 2026
- 117languageIf int *p holds address 0x1000 on a machine with 4-byte ints, what address is p + 3, and how do you step by raw bytes instead?Explain type-scaled pointer arithmetic (p + n advances by n * sizeof(*p) bytes) and why subtracting two pointers returns ptrdiff_t in elements.easyApplicationOct 21, 2026
- 118languagePointer basics: address-of and dereferenceExplain what & and * do, and how a pointer stores a memory address.easyApplicationOct 21, 2026
- 119languageWhy is POSIX shared memory (shm_open + mmap) the fastest IPC mechanism on a single host, and what synchronization hazards come with it?Contrast pipe/socket double-copy kernel traversal against zero-copy shared physical page frames, and explain why shared memory requires process-shared mutexes, semaphores, or atomics.hardApplicationOct 21, 2026
- 120languageWhy does a mismatched printf format specifier cause undefined behavior instead of automatic type conversion in C?Explain how variadic functions like printf read arguments from registers or the stack blindly using the format string without compile-time type metadata.easyApplicationOct 21, 2026
- 121languageWhat is the difference between pthread_join and pthread_detach?Explain join allows collecting exit status and waiting, detach releases resources automatically and cannot be joined.easyApplicationOct 21, 2026
- 122languageDescribe the reactor pattern for event-driven servers.Explain demultiplexing ready events, dispatching to registered handlers, and single-threaded concurrency.mediumApplicationOct 21, 2026
- 123languageWhen should you use a read-write lock instead of a mutex?Explain read-mostly workloads where multiple concurrent readers are safe, but writers need exclusive access.easyApplicationOct 21, 2026
- 124languageWhy is scanf("%s", buffer) dangerous?Explain the buffer-overflow risk of unbounded string input and how to bound it with a field width or fgets.easyApplicationOct 21, 2026
- 125languageHow does SCM_RIGHTS pass file descriptors between processes?Explain ancillary data in sendmsg/recvmsg, how a receiving process gets a new descriptor number referring to the same open file description.mediumApplicationOct 21, 2026
- 126languageWhat is the FD_SETSIZE limitation of select?Explain select's fixed fd_set size (typically 1024) and why poll/epoll scale beyond it.easyApplicationOct 21, 2026
- 127languageHow do POSIX semaphores solve the producer-consumer problem?Explain empty/full/mutex semaphores, blocking behavior, and preventing race conditions on shared buffer state.mediumApplicationOct 21, 2026
- 128languageWhat is the difference between operator precedence and order of evaluation in C, and why is i = i++ undefined behavior?Separate compile-time parse tree grouping (precedence) from runtime subexpression execution order, and explain unsequenced side effects.easyApplicationOct 21, 2026
- 129languageHow does shell redirection use dup2?Explain how shells implement `cmd > file` by opening the file and dup2-ing its descriptor onto stdout (fd 1).easyApplicationOct 21, 2026
- 130languageWhy is signal() discouraged in favor of sigaction?Explain signal() unreliable semantics across systems, and sigaction's precise control over masks, flags, and restart behavior.easyApplicationOct 21, 2026
- 131languageWhy does -1 compare greater than an unsigned int?Explain the usual arithmetic conversions that promote a signed negative operand to unsigned, making it a huge positive value.easyApplicationOct 21, 2026
- 132languageWhat is a sparse file and how does lseek create one?Explain sparse files, file holes, and how seeking past EOF then writing allocates only the written blocks.mediumApplicationOct 21, 2026
- 133languageWhat lives inside a C function's call stack frame, and what happens in memory during a stack overflow?Trace the System V AMD64 stack frame layout (return address, saved RBP, local variables, spilled registers) and explain how unbounded growth hits the guard page.easyApplicationOct 21, 2026
- 134languageWhat information does stat return about a file?Explain the struct stat fields: inode, device, mode, size, timestamps, link count, and the difference between symlink and target metadata.easyApplicationOct 21, 2026
- 135languageWhat are the two different meanings of the static keyword in C, and how does it differ from extern?Contrast static on a local variable (static storage duration in .data/.bss with block scope) against static on a file-scope symbol (internal linkage).easyApplicationOct 21, 2026
- 136languageWhy does printf output sometimes appear before a write() syscall?Explain user-space stdio buffering versus unbuffered write(), and when stdout switches from line-buffered to fully buffered.easyApplicationOct 21, 2026
- 137languageHow does strace intercept system calls?Explain ptrace-based tracing, SIGTRAP stop on syscall entry/exit, and how strace reads registers.mediumApplicationOct 21, 2026
- 138languageC strings versus char pointers: what is the difference?Explain how C strings are null-terminated char arrays and how char pointers can point to string literals or arrays.easyApplicationOct 21, 2026
- 139languageWhy does a struct's size exceed the sum of its fields?Explain compiler struct padding, alignment requirements, and how to minimize padding.easyApplicationOct 21, 2026
- 140languageHow does a compiler lower a switch statement into a jump table, and when is it faster than an if/else chain?Explain O(1) indirect dispatch via a contiguous jump table versus O(n) sequential comparisons or binary search trees for sparse case labels.easyApplicationOct 21, 2026
- 141languageWhat registers does the System V AMD64 ABI require callee to preserve?Explain callee-saved registers (RBX, RBP, R12-R15) must be saved/restored by the callee.mediumApplicationOct 21, 2026
- 142languageDescribe the TCP three-way handshake.Explain SYN, SYN-ACK, ACK, sequence numbers, and how socket() and connect() participate.easyApplicationOct 21, 2026
- 143languageWhat is the TCP TIME_WAIT state and why does it exist?Explain TIME_WAIT ensures delayed segments are not misinterpreted as new connections and SO_REUSEADDR allows rebinding.mediumApplicationOct 21, 2026
- 144languageWhat is the difference between pthread_key_t and C11 _Thread_local?Explain pthread_keys with destructor callbacks versus _Thread_local automatic per-thread storage duration.mediumApplicationOct 21, 2026
- 145languageWhat is type punning and why is it risky in C?Explain type punning via unions, strict aliasing violations, and safe alternatives like memcpy.mediumApplicationOct 21, 2026
- 146languageHow does UDP differ from TCP?Explain connectionless, unreliable, datagram-based delivery versus TCP's reliable byte stream and handshake.easyApplicationOct 21, 2026
- 147languageWhat is the difference between a variable and a pointer in C?Explain that a variable holds a value directly while a pointer holds the memory address of a value, and how dereferencing works.easyApplicationOct 21, 2026
- 148languageWhat does auto-vectorization require from the compiler?Explain loop independence, no pointer aliasing (restrict), and aligned access as prerequisites for SIMD vectorization.mediumApplicationOct 21, 2026
- 149languageHow is a running C process's virtual address space laid out across .text, .rodata, .data, .bss, heap, and stack?Map each C construct (code, string literals, globals, malloc chunks, locals) to its virtual memory segment and hardware page permissions.easyApplicationOct 21, 2026
- 150languageHow does void * enable generic functions like memcpy and qsort in C, and what are the rules for using void * and NULL safely?Explain implicit object-pointer conversion to and from void *, why void * cannot be dereferenced directly, and how generic callbacks use element size.easyApplicationOct 21, 2026
- 151languageDesign a thread pool with a task queue.Discuss worker threads, condition variable signaling, graceful shutdown, and work-stealing versus central queue trade-offs.hardApplicationOct 21, 2026
- 152languageWhat is zero-copy I/O and how do sendfile/splice help?Explain avoiding userspace copies by moving data between kernel buffers directly via sendfile, splice, and vectored I/O.mediumApplicationOct 21, 2026
- 153languageWhat is a zombie process and how do you prevent it?Explain zombies as exited processes whose exit status has not been reaped by wait/waitpid, and how to reap them.easyApplicationOct 21, 2026
- 154languageWhy does adding a field break old apps that link your library?Explain mangled names, class layout shifts, and append-only rules that keep shipped libraries compatible.hardApplicationOct 12, 2026
- 155languageWhat is the difference between an abstract class with shared state and a pure interface?Contrast pure virtuals, shared helpers, narrow interfaces, and how derived types become concrete by defining every contract function.mediumApplicationOct 12, 2026
- 156languageWhy does a relaxed flag expose incomplete data while acquire-release does not?Explain release-acquire publication, the happens-before edge, and three-permit semaphore bounds for concurrent workers.mediumApplicationOct 12, 2026
- 157languageWhen does a custom pool allocator and lock-free queue beat std::queue with std::mutex in production, and when should you stick with the STL?Evaluate contention profiles, latency tail behavior, maintenance complexity, and C++17 std::pmr alternatives across realistic thread counts.hardApplicationOct 12, 2026
- 158languageWho calls main and where does its return value go?Explain startup code, chained insertions, namespaces, and the exit status of a minimal C++ program.easyApplicationOct 12, 2026
- 159languageHow do vector and array differ in size knowledge and copying?Compare raw arrays with array and vector on size tracking, copy rules, and checked access.easyApplicationOct 12, 2026
- 160languageHow does array indexing compute an element address?Explain contiguous layout, zero based offsets, and why out of range access has no check.easyApplicationOct 12, 2026
- 161languageWhen should you choose map over unordered_map for lookup?Compare ordered tree cost and iteration order against hashed average cost, rehash, and hash quality effects.mediumApplicationOct 12, 2026
- 162languageWhen does an atomic counter beat a mutex-guarded counter?Compare fetch_add indivisibility with lock cost, flag signaling with exchange, and sharding for hot contended counters.mediumApplicationOct 12, 2026
- 163languageWhy do naive C++ microbenchmarks often produce misleading or irreproducible numbers, and how do you make a benchmark trustworthy?Identify compiler dead-code elimination, cold page faults, CPU frequency scaling, and wrong clock choices, and explain how to fix each one.hardApplicationOct 12, 2026
- 164languageWhy do raw struct bytes fail as a portable file format?Explain binary writes, fixed width types, defined byte order, and random access by record size.easyApplicationOct 12, 2026
- 165languageWhen does the right side of and or or never run?Explain precedence, De Morgan rewrites, and why short-circuit order makes operand placement part of program logic.easyApplicationOct 12, 2026
- 166languageWhen would you use each of the four named casts, and why is const_cast dangerous on truly const objects?Covers static, dynamic, const, and reinterpret cast use cases, the polymorphic requirement for dynamic_cast, and the undefined behavior of writing through const_cast on immutable storage.mediumApplicationOct 12, 2026
- 167languageHow does a class template stamp a distinct class per argument list?Describe Pair instantiation, layout per argument list, const-correct members, and header placement for member definitions.mediumApplicationOct 12, 2026
- 168languageWhy does a class with private data protect its invariant better than a struct?Explain access control, invariants, and destructor timing for a first class type.easyApplicationOct 12, 2026
- 169languageHow does a C++20 concept turn fifty lines of template errors into one line?Show an Ordered concept with requires, constrained max_of, and the boundary diagnostic for unordered Book types.mediumApplicationOct 12, 2026
- 170languageHow does an if statement execute on real hardware?Translate conditions into comparisons and jumps, trace taken paths, and name classic branch defects.easyApplicationOct 12, 2026
- 171languageHow do member-initializer lists and delegating constructors keep validation in one place?Describe direct member construction, delegation, and the Rule of Zero for a clean type.easyApplicationOct 12, 2026
- 172languageHow do you organize a C++ program across multiple source files and build it?Explain header/implementation separation, the compile-then-link model, one-definition rule, and a simple build script.easyApplicationOct 12, 2026
- 173languageWhat makes a deep copy safe when a class owns a heap buffer?Explain deep duplication, the Rule of Three, and safe assignment for an owning buffer.mediumApplicationOct 12, 2026
- 174languageHow would you structure pool and harness code with guidelines and patterns?Use ownership handles plus Builder, Strategy, and Observer to structure pool and harness code without taxing the hot path.hardApplicationOct 12, 2026
- 175languageWhy can a valid looking pointer still corrupt unrelated data?Trace dangling pointers through free and reuse to show silent corruption and defenses.easyApplicationOct 12, 2026
- 176languageHow would you debug a counter that loses increments under threads?Trace the load-add-store interleaving, separate overlap from sharing, and fix ranges plus atomics with sanitizer proof.mediumApplicationOct 12, 2026
- 177languageHow does deadlock happen with multiple mutexes, and how do std::scoped_lock and lock hierarchies prevent it?State the four Coffman conditions, trace opposite-order AB/BA acquisition, and compare std::scoped_lock deadlock-avoidance against global lock ordering.mediumApplicationOct 12, 2026
- 178languageHow does virtual inheritance give a diamond hierarchy one shared base part?Explain duplicate base parts, the virtual sharing promise, most-derived construction, and when composition is the cleaner repair.mediumApplicationOct 12, 2026
- 179languageWhy is a scoped enumeration safer than plain integers?Explain named values over integers, scoped names, explicit casts, and switch coverage.easyApplicationOct 12, 2026
- 180languageWhat do basic, strong, and nothrow guarantees promise after a throw?Distinguish valid, unchanged, and never-throw promises and show copy-and-swap with RAII discipline.mediumApplicationOct 12, 2026
- 181languageWhy do independent counters slow each other down on multicore hardware?Explain cache lines, false sharing, and the alignas sharding fix with a scaling test as proof.mediumApplicationOct 12, 2026
- 182languageHow do friends, namespaces, and operator overloads stay safe and readable?Discuss narrow friendship, scope grouping, and const-correct operator shapes for custom types.mediumApplicationOct 12, 2026
- 183languageWhy must function templates live in headers and how does deduction pick the type?Explain deduction, instantiation per type, and header placement with the max_of example for ints and strings.mediumApplicationOct 12, 2026
- 184languageDoes a function receive your variable or a copy of it?Explain arguments against parameters, pass by value, scope, lifetime, and the split between declaration and definition.easyApplicationOct 12, 2026
- 185languageHow would you design a generic Result type that chains without exceptions?Build value-or-error storage with variant, exclusive construction, and and_then chaining that forwards the first error unchanged.mediumApplicationOct 12, 2026
- 186languageWhy can including the same header twice break a build?Explain headers, translation units, include guards, and the split between undefined references and duplicate definitions.easyApplicationOct 12, 2026
- 187languageHow does member lookup and construction order work when Dog inherits from Animal?Explain base-first construction, derived-first destruction, and member lookup from derived into base with the five inheritance shapes.easyApplicationOct 12, 2026
- 188languageWhy do algorithms take iterator ranges instead of containers?Explain ranges, iterator kinds, return contracts for find and copy, and invalidation during traversal.mediumApplicationOct 12, 2026
- 189languageHow do lambda captures work, and what is the difference between value, reference, and init capture?Covers capture modes, the mutable keyword, lifetime implications, and generalized lambda capture for move-only types.mediumApplicationOct 12, 2026
- 190languageWhat happens when a joinable thread is destroyed without join or detach?Explain the C++ rule that terminating a joinable thread calls std::terminate, why the rule exists, and how to ensure every thread is joined or detached on all control paths.mediumApplicationOct 12, 2026
- 191languageHow would you build a polymorphic catalog that stores mixed items and destroys them safely?Design an abstract Item with virtual loan and print behavior, unique ownership for mixed storage, and full teardown without slicing.mediumApplicationOct 12, 2026
- 192languageHow would you code a checkout that fails without residue?Build a LibraryError family, validate before mutation, stage on a copy, and commit without failure.mediumApplicationOct 12, 2026
- 193languageWhat is the ABA problem in lock-free data structures, why does it break a naive CAS free list or queue, and how do hazard pointers or epochs solve it?Walk through a 3-step interleaving where pointer A is popped, freed, reallocated at the same address A with a different next pointer, and passes compare_exchange.hardApplicationOct 12, 2026
- 194languageIn what order do the three parts of a for header execute?Compare while, do while, and for, trace init, test, body, and update order, and spot a loop that never ends.easyApplicationOct 12, 2026
- 195languageWhat is a pointer to member, and how does std::function achieve type erasure for callables?Covers pointer-to-member syntax and invocation, the difference between member pointers and virtual dispatch, and the cost and benefit of type-erased callable wrappers.mediumApplicationOct 12, 2026
- 196languageHow would you build a move-only task that runs exactly once?They want an id plus erased callable with deleted copies, moves that clear the source, and a validity guard before each run.mediumApplicationOct 12, 2026
- 197languageHow does std::move enable resource transfer without copying, and what must a move constructor guarantee about the moved-from object?Explains the mechanics of rvalue references, the role of std::move as a cast, and the moved-from object contract.mediumApplicationOct 12, 2026
- 198languageHow do you protect shared data with mutex and lock guards?Explain the difference between std::mutex, lock_guard, and unique_lock, and when to use each for thread-safe data access.mediumApplicationOct 12, 2026
- 199languageHow do you prove a loop boundary is correct?State a loop invariant, check init, maintenance, and exit, and pick boundary tests that expose off-by-one errors.easyApplicationOct 12, 2026
- 200languageHow does the compiler choose among overloaded functions?Explain overload ranking, ambiguous calls, name mangling, and when default arguments are filled in.easyApplicationOct 12, 2026
- 201languageHow do you safely parse a CSV line into typed values in C++?Explain splitting on delimiters, converting with from_chars, handling empty or malformed fields, and why this is safer than stoi.easyApplicationOct 12, 2026
- 202languageWhen should a parameter be a value, a reference, or a const reference?Compare effects on the caller, machine cost, aliasing, and the rule for literals with reference parameters.easyApplicationOct 12, 2026
- 203languageHow should a function take and return a struct?Choose value, reference and pointer forms for structs and explain free return by value.easyApplicationOct 12, 2026
- 204languageWhy does adding one to a pointer move by a whole element?Explain scaled arithmetic, array decay, and the one past the end rule for loops.easyApplicationOct 12, 2026
- 205languageWhen should a function take a pointer instead of a reference?Compare rebinding, null state, and assignment for references versus pointers.easyApplicationOct 12, 2026
- 206languageWhat does a pointer hold and what happens when you follow it?Explain address storage, typed dereference, aliasing from copies, and null dangers.easyApplicationOct 12, 2026
- 207languageHow does a fixed-size pool allocator achieve O(1) allocation and zero per-slot memory overhead using an intrusive free list?Trace how unallocated slots store their own next-free pointer in-place, explain alignment and object lifetime rules, and state the trade-offs of pools.hardApplicationOct 12, 2026
- 208languageWhy must std::condition_variable::wait always check its condition in a predicate loop, and how do you shut down a blocking queue cleanly?Explain spurious wakeups and stolen wakeups, trace how cv.wait atomically unlocks and sleeps, and show the done-flag shutdown pattern.mediumApplicationOct 12, 2026
- 209languageHow do you find the hot path with perf and flame graphs?Walk through perf record and report, flame graph reading, and the rerun that proves a layout fix.mediumApplicationOct 12, 2026
- 210languageHow do you read a compiler diagnostic that lists several errors?Show how to find the file, line, and severity, fix the first error first, and enable warnings that catch defects early.easyApplicationOct 12, 2026
- 211languageWhat happens when extraction fails and how do you recover?Describe stream state after bad input, the clear and ignore repair, and the leftover newline with line input.easyApplicationOct 12, 2026
- 212languageHow does a read loop separate end of file from failure?Describe getline loops, stream flags, and handling of odd line endings and bad lines.easyApplicationOct 12, 2026
- 213languageWhat stops a recursive function from calling itself forever?Identify base and recursive cases, trace frame buildup and unwind, and compare naive recursion cost with a loop.easyApplicationOct 12, 2026
- 214languageWhat are the five special member functions, and when should you default or delete each one?Covers the rule of five, the interaction between user-declared operations and implicit generation, and the use of =default and =delete to express intent.mediumApplicationOct 12, 2026
- 215languageHow would you build a leak-free Contact with history, photo, copy, and print?Design a Contact that combines vector history, unique photo, safe copy and move, and a friend printer.mediumApplicationOct 12, 2026
- 216languageHow do you prove a thread pool correct with sanitizers and unit tests?Run address plus undefined and thread builds, assert single execution and drain, and read reports to file and line.mediumApplicationOct 12, 2026
- 217languageHow would you code a catalogue with vector, map, and hashed lookup?Design a primary store plus ordered and hashed indexes, route each query by cost, and state probe counts.mediumApplicationOct 12, 2026
- 218languageWhen should you use unique_ptr, shared_ptr, or weak_ptr for ownership?Compare exclusive ownership, counted sharing, and non-owning observation with modern creation.mediumApplicationOct 12, 2026
- 219languageWhat does each stage of a C++ build produce?Trace preprocessing, compiling, and linking, and map each common build error to the stage that reports it.easyApplicationOct 12, 2026
- 220languageHow do you choose a standard exception and shape a custom type?Select invalid_argument and out_of_range correctly, derive focused types, and keep what and order exact.mediumApplicationOct 12, 2026
- 221languageHow do you find a wrong value with a debugger?Explain breakpoints, stepping choices, and variable inspection for locating the first line that produces a bad value.easyApplicationOct 12, 2026
- 222languageWhen does a short string avoid the heap and when do views expire?Cover size, capacity, null guarantee, small-string storage, and why views must refresh after growth.easyApplicationOct 12, 2026
- 223languageWhy does growing a vector by doubling keep pushes cheap?Explain size versus capacity, doubling growth with linear total moves, and why pointers expire on reallocation.easyApplicationOct 12, 2026
- 224languageHow do C strings and std string differ in length and safety?Contrast zero terminated text with owned strings and views for read only access.easyApplicationOct 12, 2026
- 225languageWhy can a struct be larger than the sum of its members?Explain alignment, internal and tail padding, and ordering that reduces waste.easyApplicationOct 12, 2026
- 226languageHow does a struct lay out members and copy them?Explain fixed offsets, brace initialization, and memberwise value copying for records.easyApplicationOct 12, 2026
- 227languageHow do you design a thread pool in C++ so task execution does not block submissions and shutdown never leaks or drops work?Walk through the state invariants of a production thread pool: critical section minimization, exception handling inside workers, and destructor drain semantics.mediumApplicationOct 12, 2026
- 228languageWhen does a full specialization win over the primary template?Contrast the generic print fallback with custom bodies for string literals and owned strings, including the string header fix.mediumApplicationOct 12, 2026
- 229languageWhere do function calls keep their data and return addresses?Describe frames, push and pop order, backtraces, leftover locals, and the cause of a stack overflow.easyApplicationOct 12, 2026
- 230languageWhen does an object belong on the heap instead of the stack?Explain heap lifetime, matching delete forms, leaks from lost pointers, and owner types.easyApplicationOct 12, 2026
- 231languageWhy do you catch exceptions by reference and order handlers derived first?Cover throw, unwinding with RAII, reference binding without slicing, and handler order from specific to general.easyApplicationOct 12, 2026
- 232languageWhy can the same bytes mean minus one or four billion?Explain size, signedness, two's complement, wraparound, and the rules behind mixed-type comparisons.easyApplicationOct 12, 2026
- 233languageWhat happens when an index runs past the end of an array?Describe the memory effect of an out of bounds access and the tools that catch it early.easyApplicationOct 12, 2026
- 234languageWhat is a variable once the program is compiled?Describe variables as typed byte regions, little-endian layout, copying, and the risk of uninitialized reads.easyApplicationOct 12, 2026
- 235languageWhy is appending to a vector cheap on average despite copying?Explain size versus capacity, doubling growth, and why references expire on reallocation.easyApplicationOct 12, 2026
- 236languageWhy does a polymorphic base need a virtual destructor when deleting through a base pointer?Explain virtual destruction order, undefined behavior without it, and the rule that every polymorphic base owns a virtual destructor.mediumApplicationOct 12, 2026
- 237languageHow does one virtual call through a base pointer reach different derived implementations?Explain vtables, vptrs, override checking, and why the object type selects the function while the pointer type checks legality.easyApplicationOct 12, 2026
- 238languageWhy is per-node heap allocation (new/delete) often the dominant bottleneck in C++ data structures, and how do you prove it in a profiler?Explain allocator metadata/locking costs, TLB and cache misses from scattered heap nodes, and how to separate allocation time from algorithmic work.hardApplicationOct 12, 2026
- 239languageWhere does text wait between insertion and the disk file?Explain open modes, buffering, flush timing, and safe record formats for text output.easyApplicationOct 12, 2026
- 240dsaHow would you count distinct users across a fleet of services in constant memory?Design a pipeline for daily unique users that never ships an ID set: sketch per service, merge by register maximum, and quantify the error you are reporting.hardApplicationOct 7, 2026
- 241dsaWhy can't a sparse table answer range sums?Explain idempotence versus associativity, the overlap that double-counts, and what you would use for range sums instead.hardApplicationOct 7, 2026
- 242dsaWhy is a lock-free stack still hard to get right?Explain what a CAS loop buys over a mutex, and the three ways it still breaks: publication ordering, ABA, and freeing a node a reader still holds.hardApplicationOct 7, 2026
- 243dsaHow does A* differ from Dijkstra, and what makes a heuristic valid?Explain the g + h ordering, admissibility and consistency, heuristic choice, and the speed-optimality trade-off.mediumApplicationOct 5, 2026
- 244dsaAdjacency list or adjacency matrix: how do you choose?Compare memory and operation costs, connect them to sparse and dense graphs, and mention the representations real systems use.easyApplicationOct 5, 2026
- 245dsaAverage latency is fine, but a few requests take 200 ms. How could an amortized data structure cause that?Connect amortized bounds to tail latency, diagnose resize spikes, and fix them with preallocation, incremental resizing or sharding.hardApplicationOct 5, 2026
- 246dsaInsert 30, 20, 25 into an AVL tree. Which rotations happen, and why?Walk through AVL balance factors, the four imbalance cases, and single and double rotations.mediumApplicationOct 5, 2026
- 247dsaAVL or red-black tree: how do they differ, and which would you choose?Compare the two balancing rules, their height bounds and update costs, and why standard libraries pick red-black trees.hardApplicationOct 5, 2026
- 248dsaHow does backtracking differ from brute force, and how do you prune?Explain the search tree, the choose-explore-unchoose pattern, how pruning cuts whole subtrees, and how to estimate the cost.mediumApplicationOct 5, 2026
- 249dsaBFS or DFS on a tree: which would you use, and what does each cost in memory?Compare breadth-first and depth-first traversal by visiting order, typical uses and peak memory on wide and deep trees.easyApplicationOct 5, 2026
- 250dsaWhen would you use a binary search tree instead of a hash table?Compare costs, guarantees and supported operations, and name the library types that implement each.easyApplicationOct 5, 2026
- 251dsaHow would a build system decide the order to build targets?Model dependencies as a DAG, produce a topological order, detect cycles, and extend it to parallel and incremental builds.mediumApplicationOct 5, 2026
- 252dsaCount the islands in a grid. What changes for a 100,000 × 100,000 grid?Solve the classic flood-fill problem, then discuss recursion depth, memory, streaming rows and parallelism for a huge grid.mediumApplicationOct 5, 2026
- 253dsaHow do you delete a node with two children from a binary search tree?Walk through the three deletion cases, explain why the successor is a valid replacement, and give the cost.mediumApplicationOct 5, 2026
- 254dsaHow would you delete many elements from an array efficiently?Explain why repeated single deletes are quadratic, then give the one-pass compaction, the swap-with-last trick and when to change data structure.easyApplicationOct 5, 2026
- 255dsaDesign a leaderboard that reports top scores and any player's rankCombine a hash map with an order-statistic structure to update scores, list the top k and compute ranks in O(log n).mediumApplicationOct 5, 2026
- 256dsaDesign the data structure behind search autocompleteReturn the top suggestions for a typed prefix quickly, with a trie whose nodes cache their best completions.mediumApplicationOct 5, 2026
- 257dsaHow do you detect a cycle in a directed graph?Explain why a visited set isn't enough, then give the three-color DFS and Kahn's algorithm, with their costs and uses.mediumApplicationOct 5, 2026
- 258dsaHow do you detect a cycle in a linked list in O(1) space, and why does it work?Explain Floyd's tortoise and hare, prove that the pointers meet, and find where the cycle starts.mediumApplicationOct 5, 2026
- 259dsaDetect a currency arbitrage opportunityModel exchange rates as a graph, turn profitable loops into negative cycles with logarithms, and find them with Bellman-Ford.hardApplicationOct 5, 2026
- 260dsaFind the diameter of a binary tree in one passExplain why the longest path turns at some node, and compute it with one postorder pass that returns heights.easyApplicationOct 5, 2026
- 261dsaWhy does Dijkstra's algorithm fail with negative edges?Explain the proof Dijkstra relies on, give a counterexample, and say what to use instead.mediumApplicationOct 5, 2026
- 262dsaHow does Compare-And-Swap work at the CPU cache-coherency level, and when do you need acquire/release versus seq_cst?Explain atomic RMW operations, spurious LL/SC failures on ARM, happens-before edges with release/acquire ordering, and CAS retry loops.hardApplicationOct 5, 2026
- 263dsaHow do you benchmark a data structure in C++ or Rust without dead-code elimination, branch-predictor warmup skew, or CPU frequency scaling ruining your numbers?Use hardware performance counters (perf stat cycles, instructions, cache-misses, branch-misses), black_box barriers, and p50/p99 distributions.hardApplicationOct 5, 2026
- 264dsaHow does a Bloom filter guarantee zero false negatives in O(k) bit lookups, and how do you size m bits and k hashes for a 1% false positive rate?Derive the optimal bit-per-key ratio (~9.6 bits/key for 1% FPR, k = ln(2) * m/n), explain why deletion breaks standard Bloom filters, and where LSM-trees use them.hardApplicationOct 5, 2026
- 265dsaWhy does traversing a 64-byte cache-line-aligned array outperform a pointer-chasing linked list by 10x–20x even when both are O(n)?Explain 64-byte CPU cache lines, hardware spatial prefetching, L1/L2/L3 vs DRAM latency, and pointer-chase memory stalls.hardApplicationOct 5, 2026
- 266dsaWhat is the exact difference between a data race and a race condition, and when does fine-grained mutex locking lose to sharded or lock-free structures?Distinguish undefined/unsynchronized memory access (data race) from interleaved invariant violations (race condition), and analyze mutex contention and false sharing.hardApplicationOct 5, 2026
- 267dsaExplain the Michael-Scott lock-free queue and the ABA problem: how can a CAS succeed when the pointer address matches yet corrupt the queue?Trace how recycling node A (`A -> B -> A`) fools raw pointer CAS into linking a freed or reallocated node, and solve it with tagged pointers or hazard pointers.hardApplicationOct 5, 2026
- 268dsaWhy can't a lock-free data structure immediately free a node after CAS unlinking, and how do EBR and Hazard Pointers solve it?Compare Epoch-Based Reclamation (EBR / crossbeam-epoch, grace periods) against Hazard Pointers (bounded memory under stalled threads) for safe lock-free deallocation.hardApplicationOct 5, 2026
- 269dsaHow would you answer "are these two users connected?" as friendships keep arriving?Design an incremental connectivity service with union-find, and explain its limits.mediumApplicationOct 5, 2026
- 270dsaHow would you compute edit distance between two very large strings?Start from the O(m × n) table, reduce memory to two rows, recover the edits in linear space, and speed up the common case.hardApplicationOct 5, 2026
- 271dsaFind the first and last position of a value in a sorted arraySolve it with two boundary searches in O(log n), and explain the invariant that makes each correct.mediumApplicationOct 5, 2026
- 272dsaWhy must the intermediate vertex be the outer loop in Floyd-Warshall?Explain the dynamic programming state behind the triple loop and what goes wrong with other loop orders.mediumApplicationOct 5, 2026
- 273dsaWalk through inserting into and removing from a binary heapExplain sift-up and sift-down, why each preserves the heap property, and their costs.easyApplicationOct 5, 2026
- 274dsaHow does a diff tool find the changes between two files?Connect diff to the longest common subsequence, describe the table and the reconstruction, and say how real tools make it fast for large files.mediumApplicationOct 5, 2026
- 275dsaHow do you work out the time complexity of a piece of code?Walk through counting steps, multiplying nested loops, spotting hidden loops in library calls, and simplifying to Big-O.easyApplicationOct 5, 2026
- 276dsaHow does a ring buffer work, and why do systems use it?Explain head, size and wrap-around, full versus empty, growth and overflow policies, and where ring buffers appear in real systems.easyApplicationOct 5, 2026
- 277dsaHow does git bisect find the commit that introduced a bug?Explain bisect as a binary search over history with a monotonic predicate, its cost, how to automate it, and what breaks it.easyApplicationOct 5, 2026
- 278dsaHow does Huffman coding work, and why is it optimal?Explain prefix codes, the heap-based construction, the exchange-argument proof, and where Huffman coding is used and outperformed.mediumApplicationOct 5, 2026
- 279dsaHow is a two-dimensional array stored in memory?Explain row-major and column-major layout, the index formula, arrays of arrays, and why the layout decides how fast a loop runs.easyApplicationOct 5, 2026
- 280dsaHow does KMP search in linear time without moving backward in the text?Explain borders, the prefix function and its fallback, and the amortized argument for O(n + m).hardApplicationOct 5, 2026
- 281dsaHow would you implement a priority queue, and why a binary heap?Compare candidate structures, explain the heap's array layout and costs, and say when a different structure is better.easyApplicationOct 5, 2026
- 282dsaHow would you implement undo and redo?Design undo and redo with two stacks of commands, and discuss memory limits, grouping and what happens when a new edit arrives after an undo.mediumApplicationOct 5, 2026
- 283dsaExplain Kadane's algorithm for the maximum subarray sum, and why it worksDerive the best-ending-here recurrence, prove it, and extend it to related problems.mediumApplicationOct 5, 2026
- 284dsaWhat are Las Vegas and Monte Carlo algorithms? Give an example of eachContrast randomized algorithms that are always correct with ones that are always fast, and explain how repetition controls error.mediumApplicationOct 5, 2026
- 285dsaSchedule the most meetings in one roomSolve interval scheduling with the earliest-end greedy, prove it, refute the alternatives, and handle the weighted variant.mediumApplicationOct 5, 2026
- 286dsaTop-down memoization or bottom-up tabulation: how do you choose?Compare the two styles of dynamic programming on states computed, recursion depth, speed and memory.easyApplicationOct 5, 2026
- 287dsaMerge sort or quick sort: how do you choose?Compare guarantees, memory, stability, cache behavior and suitability for linked lists and external data.mediumApplicationOct 5, 2026
- 288dsaMerge two sorted arrays when the first has room for bothMerge in O(m + n) time and O(1) extra space by filling from the back, and explain why the front doesn't work.easyApplicationOct 5, 2026
- 289dsaHow many meeting rooms do you need?Solve the minimum rooms problem with a sweep over start and end events or a min-heap of end times, and handle ties correctly.mediumApplicationOct 5, 2026
- 290dsaFind the next greater element for every element in O(n)Solve it with a monotonic stack, explain why it is linear, and adapt it to related questions.mediumApplicationOct 5, 2026
- 291dsaWhy can't you get the nth character of a UTF-8 string in constant time?Explain code points, variable-width encodings, how different languages represent strings, and the trade-offs between them.mediumApplicationOct 5, 2026
- 292dsaPrim or Kruskal: which would you use, and why?Compare the two minimum spanning tree algorithms by graph density, storage and cost, and contrast Prim with Dijkstra.mediumApplicationOct 5, 2026
- 293dsaProve that serving the shortest job first minimizes total waiting timeGive the adjacent-swap exchange argument, then generalize it to weighted jobs.mediumApplicationOct 5, 2026
- 294dsaProve that universal hashing gives O(1) expected lookups for any set of keysDefine a universal family, derive the expected chain length with indicator variables, and state exactly what the bound does and doesn't promise.hardApplicationOct 5, 2026
- 295dsaWhen would you choose recursion over iteration?Compare clarity, stack depth and call overhead, and show how to convert between the two.easyApplicationOct 5, 2026
- 296dsaReverse a linked list, iteratively and recursivelyWrite both versions, state the loop invariant, and compare their time and space.easyApplicationOct 5, 2026
- 297dsaHow do you make a rolling hash safe against collisions?Explain polynomial rolling hashes, why collisions happen, and how base, modulus and verification control them.mediumApplicationOct 5, 2026
- 298dsaSearch in a rotated sorted arrayFind a target in O(log n) in a sorted array that was rotated, and explain the property that makes it possible.mediumApplicationOct 5, 2026
- 299dsaHow can sorting be faster than O(n log n)?Explain the comparison lower bound and how counting, radix and bucket sort get around it, with their limits.mediumApplicationOct 5, 2026
- 300dsaCount the subarrays that sum to k, when values can be negativeExplain why a sliding window fails, then solve it in O(n) with prefix sums and a hash map.mediumApplicationOct 5, 2026
- 301dsaFind all unique triples that sum to zeroSolve 3Sum in O(n²) with sorting and two pointers, and avoid duplicate triples without a set.mediumApplicationOct 5, 2026
- 302dsaFind the k largest items in a stream of a billionUse a size-k min-heap, explain the heap direction and the costs, and compare with sorting and quickselect, including distributed variants.mediumApplicationOct 5, 2026
- 303dsaWhen would you trade memory for speed, and when not?Discuss time–space trade-offs with concrete examples, the hidden memory costs of common code, and when the slower, smaller solution is the right one.mediumApplicationOct 5, 2026
- 304dsaExplain preorder, inorder and postorder traversal, and when you would use eachDefine the three depth-first orders, give a real use for each, and discuss their cost and iterative versions.easyApplicationOct 5, 2026
- 305dsaProve that a queue built from two stacks has O(1) amortized operationsUse the accounting or potential method to bound the cost of moving items between stacks.hardApplicationOct 5, 2026
- 306dsaWhat does Big-O tell you, and what does it hide?Explain the definition, why constants and smaller terms are dropped, and the real costs that can make an asymptotically better algorithm slower in practice.mediumApplicationOct 5, 2026
- 307dsaWhat causes a stack overflow, and how do you avoid it in a recursive algorithm?Explain the call stack, frame sizes and limits, how deep recursion overflows, and how to rewrite recursion with an explicit stack or reduce its depth.easyApplicationOct 5, 2026
- 308dsaWhat happens, step by step, when a function is called?Walk through the calling convention, the call and return instructions, the prologue and epilogue, and what a call really costs.mediumApplicationOct 5, 2026
- 309dsaWhat happens when an integer overflows?Explain two's complement, what the hardware does when a result doesn't fit, how languages differ, and how overflow turns into real bugs.easyApplicationOct 5, 2026
- 310dsaWhat is a stable sort, and when does stability matter?Define stability, show how it enables multi-key sorting, and say which standard library sorts are stable.easyApplicationOct 5, 2026
- 311dsaWhat is dynamic programming, and how do you recognize a DP problem?Define DP by its two properties, contrast it with divide and conquer and greedy algorithms, and describe a method for designing a DP.mediumApplicationOct 5, 2026
- 312dsaWhen does a greedy algorithm give the optimal answer?State the conditions, show how to prove or disprove a greedy rule, and contrast greedy with dynamic programming using examples.mediumApplicationOct 5, 2026
- 313dsaWhen does a sliding window work, and when doesn't it?Explain the fixed and variable window templates, the monotonic property they rely on, and what to use when it fails.mediumApplicationOct 5, 2026
- 314dsaWhen would you build a suffix array, and what does it give you?Explain suffix arrays and LCP arrays, the queries they answer, how they are built, and simpler alternatives.hardApplicationOct 5, 2026
- 315dsaWhy does BFS find shortest paths in an unweighted graph?Explain BFS, argue why first discovery gives the shortest distance, and state when the argument breaks.mediumApplicationOct 5, 2026
- 316dsaWhy isn't a plain binary search tree O(log n)?Explain how insertion order determines a binary search tree's height, which inputs break it, and what balancing must guarantee.mediumApplicationOct 5, 2026
- 317dsaWhy can summing a matrix column by column be several times slower than row by row?Explain row-major layout, cache lines, strides and the prefetcher, and say how you would fix and verify it.mediumApplicationOct 5, 2026
- 318dsaWhy do databases use B-trees instead of binary search trees?Explain page-based storage, B-tree fan-out and height, splits that grow the tree at the root, and B+ tree range scans.mediumApplicationOct 5, 2026
- 319dsaWhy does a dynamic array grow by a factor instead of a fixed amount?Explain size and capacity, count the copies of doubling versus fixed growth, and discuss amortized O(1), growth factors and their trade-offs.easyApplicationOct 5, 2026
- 320dsaWhy do many hash tables use a power-of-two capacity with a bitmask instead of modulo?Compare modulo division against bitwise AND masking for slot indexing, and explain how hash mixing prevents low-bit collisions.easyApplicationOct 5, 2026
- 321dsaWhy is building a heap O(n) and not O(n log n)?Explain bottom-up heapify, sum the work level by level, and contrast it with inserting items one by one.mediumApplicationOct 5, 2026
- 322dsaWhy is the naive recursive Fibonacci so slow, and how do you fix it?Draw the recursion tree, count the calls, and give the memoized, bottom-up and constant-space versions.easyApplicationOct 5, 2026
- 323dsaWhy does Kruskal's greedy algorithm produce a minimum spanning tree?State the cut property, prove it with an exchange argument, and apply it to Kruskal's choices.hardApplicationOct 5, 2026
- 324dsaWhy do library sort functions still use insertion sort?Explain insertion sort's cost in terms of inversions, why it beats O(n log n) sorts on small and nearly sorted inputs, and where libraries use it.easyApplicationOct 5, 2026
- 325dsaWhy does a Python list of numbers use so much more memory than a C array?Explain references, boxed objects and contiguity, put numbers on the overhead, and say when it is worth switching to array or NumPy.easyApplicationOct 5, 2026
- 326dsaWhy is quick sort fast in practice despite its O(n²) worst case?Explain partitioning, the average-case analysis, what triggers the worst case, and the defenses real implementations use.mediumApplicationOct 5, 2026
- 327dsaWhy are union-find operations nearly constant time?Explain union by size, path compression and the inverse Ackermann bound.mediumApplicationOct 5, 2026
- 328dsaWhat is the difference between worst-case, average-case, expected and amortized cost?Define each term, give an example of each, and explain which kind of promise each one makes.mediumApplicationOct 5, 2026
- 329dsa0/1 knapsack vs unbounded knapsack: what changes in the code?Write both with a one-dimensional table, explain why the loop direction is the whole difference, and discuss complexity.mediumApplicationOct 5, 2026
- 330dsaWhy is a hash map lookup O(1) on average but O(n) in the worst case?Explain where the constant-time promise comes from, what has to go wrong for a lookup to take linear time, and how real hash maps keep the worst case rare.easyApplicationOct 3, 2026
- 331dsaWhy does a hash map resize before it is full?Explain the load factor, why a fuller table gets slower, why tables double instead of growing by a fixed amount, and what a resize costs.easyApplicationOct 3, 2026
- 332dsaWhat goes wrong when you change a key after putting it in a hash map?Explain why a key that changes while it is stored becomes unreachable, how hashing and equality must agree, and how different languages protect you.mediumApplicationOct 3, 2026
- 333dsaWhy do Python, Rust and Go randomize their string hashes?Explain the attack that randomized hashing prevents, why it is realistic for a server, how a secret key defends against it, and what the defense costs.mediumApplicationOct 3, 2026
- 334algorithmsWhen should you pass by pointer, by reference, or by value in C++?State what each choice copies, what it costs, and the rule for picking between them, including null and reassignment.easyApplicationSep 26, 2026
- 335dsaWhat's the difference between an array and a linked list, in theory and in practice?Compare their Big-O, then explain why arrays win most real benchmarks and where linked lists are still the right choice.easyApplicationSep 26, 2026
- 336dsaPointers vs references vs valuesExplain what passing by value, by pointer and by reference copies, what each costs, and when to use which.easyApplicationSep 26, 2026
- 337databasesHow do you find the data access that dominates a query's cost?Use buffer reads and row counts with elapsed time to locate the costly access, and compare N+1 query counts before and after batching.mediumApplicationSep 25, 2026
- 338databasesHow does a B-tree index narrow a database search?Trace separator-key navigation from root to leaf, show why composite column order controls which predicates use the index, and when the planner prefers a scan.mediumApplicationSep 25, 2026
- 339databasesWhen is a sequential scan better than an index scan?Compare selective index access against ordered full-table reads, and use estimated versus actual rows to confirm which plan the data supports.mediumApplicationSep 25, 2026
- 340dsaDesign an LRU cache with constant-time operationsCombine a hash map with a doubly linked list so that get, put and eviction are all O(1), and discuss the edge cases and concurrency.mediumApplicationSep 25, 2026
- 341dsaWhy can binary search be slower than a linear scan?Explain the constant factors behind O(log n) versus O(n): cache misses, branch prediction and vectorization, and how you would find the crossover.mediumApplicationSep 25, 2026