InterviewStack.io LogoInterviewStack.io

Core Data Structures Questions

Fundamental built in data structures used in everyday programming and coding interviews, focusing on lists, strings, and dictionaries. For lists cover indexing, slicing, iteration, common mutation operations such as append and extend, common algorithms such as sorting and reversing, and memory and performance implications. For strings cover indexing, slicing, common methods such as split, join, strip, replace, and approaches to string manipulation and pattern processing. For dictionaries cover key value semantics, insertion and lookup, iteration patterns, methods for safe access, and using dictionaries as hash tables for counting and grouping. Candidates should also know the time complexity of common operations expressed in plain terms such as constant time, linear time, and quadratic time, and be able to choose the appropriate structure for a problem and reason about space and performance tradeoffs. Practice often includes implementation level manipulations, common interview problems such as two sum and frequency counting, and writing clear code using these structures.

MediumTechnical
0 practiced
You have a list of service records: [{"name": "svc1", "latency": 123}, ...]. Implement a stable sort in Python to order services by descending latency. Explain how Python's Timsort preserves stability and why that might matter when sorting by multiple keys (e.g., latency then name). Discuss time complexity and in-place vs returning a new list.
MediumTechnical
0 practiced
You must design an in-memory aggregator for metric series: 10 million distinct series, each storing the last 60 float values (one per minute). Choose appropriate core data structures (Python list, array.array, deque, or external libs) and estimate approximate memory usage and trade-offs. Explain choices to reduce memory overhead while keeping fast append and O(1) access to latest values.
EasyTechnical
0 practiced
Write a Python function remove_in_place(lst, predicate) that removes all items from lst for which predicate(item) returns True. The function must modify the input list in place, preserve the original order of remaining elements, and use O(1) extra space (no allocating another list of size n). Provide code and explain time complexity.
MediumTechnical
0 practiced
Implement a MovingAverage class in Python that maintains the average of the last N numeric values in a stream. Methods: add(value) and get_avg(). It should run add() in O(1) amortized time and use O(N) memory. Show code using collections.deque and explain how you'd adapt it for very high-throughput SRE telemetry ingestion.
EasyTechnical
0 practiced
Describe string immutability in a language like Python. Explain how operations such as indexing (s[i]), slicing (s[a:b]), and methods like s.replace(old, new) behave with respect to object creation. Discuss time complexity of indexing and slicing, and explain why repeated concatenation in loops can be slow in production SRE scripts.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.