InterviewStack.io LogoInterviewStack.io

Algorithms and Data Structures Questions

Comprehensive understanding of core data structures such as arrays, linked lists, stacks, queues, hash tables, trees, heaps, and graphs, and fundamental algorithms including sorting, searching, traversal, string manipulation, and graph algorithms. Ability to analyze and compare time and space complexity using asymptotic notation such as Big O, Big Theta, and Big Omega, and to reason about trade offs between different approaches. Skills include selecting the most appropriate data structure for a problem, designing efficient algorithms, applying algorithmic paradigms such as divide and conquer, dynamic programming, greedy methods, and graph search, and implementing correct and robust code for common interview problems. At more senior levels, this also covers optimizing for large scale through considerations of memory layout, caching, amortized analysis, parallelism and concurrency where applicable, and profiling and tuning for performance in realistic systems.

MediumTechnical
100 practiced
Write Python code to perform an in-place partition step used by quickselect (partition around a pivot) and explain how quickselect finds the k-th smallest element in average O(n) time. Discuss worst-case behavior and practical improvements to avoid pathological pivots (median-of-medians, sampling).
HardSystem Design
93 practiced
You must maintain per-user distinct count (number of unique items) over a sliding 24-hour window for millions of users, with strict memory limits. Propose a hybrid design using approximate sketches (HLL) for most users, exact counters for heavy users, eviction strategies, hierarchical aggregation, and techniques to bound state size. Explain merging, error budgets, and cold-start behavior.
HardSystem Design
91 practiced
Design a streaming deduplication system with exactly-once semantics for events ingested via Kafka, processed by a stream processor (for example Flink). Consider event IDs, state backend choices (RocksDB), state TTL, checkpointing, latency, and how to bound state size while preserving correctness. Describe algorithmic steps and failure recovery behavior.
MediumTechnical
78 practiced
You need to deduplicate billions of incoming IDs in a streaming ingestion pipeline where RAM is limited. Describe how a Bloom filter can be used for deduplication, derive formulas for sizing the filter (bits per element and number of hash functions) given expected n and acceptable false positive rate p, and discuss operational concerns like false positives, inability to delete, and checkpointing.
HardTechnical
123 practiced
You need to estimate join cardinality between two tables A and B for a query optimizer. Describe algorithmic approaches to estimate selectivity including histograms (equi-depth/equi-width), sketches, sampling, and how to combine column statistics for multi-column predicates. Discuss accuracy challenges with correlated columns and suggestions to mitigate them.

Unlock Full Question Bank

Get access to hundreds of Algorithms and Data Structures interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.