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.

HardTechnical
0 practiced
You need to count occurrences of log patterns that are described by complex regexes over a log file too large to fit in memory. Describe an algorithm that reads the file in chunks and counts matching patterns, ensuring correctness even when a pattern can span chunk boundaries. Discuss memory, time, and why naive chunking may break pattern matching.
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.
HardTechnical
0 practiced
You're tasked with estimating unique IP count from 1 billion events with only 1 GB of RAM. Compare exact methods (Python dict of seen IPs) with probabilistic sketches (Bloom filter, HyperLogLog). Give approximate memory estimates and error characteristics and recommend an approach suitable for SRE dashboards that need daily cardinality estimates.
MediumTechnical
0 practiced
You have a large list used as a lookup table and a heavy number of membership queries. Implement a Python function membership_answers(lst, queries) that decides whether to convert the list to a set for faster lookups depending on the number of queries and list size. Explain the heuristic and trade-offs in time and memory.
MediumTechnical
0 practiced
Implement nested_get(data, path, default=None) in Python where data may be a nested mixture of dicts and lists and path is a list like ['a', 0, 'b'] representing data['a'][0]['b']. Return default if any part of the path is missing. Provide a robust implementation and discuss error handling and performance.

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.