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.

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.
HardTechnical
0 practiced
Implement an LRU (Least Recently Used) cache in Python with get(key) and put(key, value) operations that both run in O(1) time. Do not use collections.OrderedDict. Use a dictionary plus a doubly-linked list and discuss thread-safety concerns when used in a multi-threaded SRE tool.
HardTechnical
0 practiced
Given up to 1 million lowercase ASCII strings, design and implement in Python an efficient approach to group anagrams together. Provide an implementation that minimizes memory overhead compared to storing sorted strings for keys, and explain your choice of keying function (sorted string vs fixed-size frequency tuple). Consider performance for very long strings.
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.
HardTechnical
0 practiced
Implement dedupe_preserve_order(seq) in Python that returns a new sequence with duplicates removed while preserving first occurrence order. The function must correctly deduplicate both hashable and unhashable elements (e.g., tuples and dicts). Discuss time/space complexity and trade-offs for handling unhashable items.

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.