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
Explain the difference between mutable and immutable types in Python, and why tuples can be used as dictionary keys while lists cannot. Provide examples that show subtle bugs when using mutable objects as dict keys or inside sets, and explain how this impacts caching and memoization in AI model code.
HardTechnical
0 practiced
Discuss tradeoffs between using Python lists, array.array, and numpy arrays (or tensors) to store large numeric datasets used for model input. Compare memory layout, mutation semantics, slicing behavior (view vs copy), and typical operations (vectorized ops vs Python loops). Recommend choices for AI training vs light-weight metadata storage.
EasyTechnical
0 practiced
Given the Python list:
L = [10, 20, 30, 40, 50]
Explain the result of each expression and why: L[1:4], L[-2:], L[:], L[::2], L[::-1]. For each expression state the returned value, whether a copy or view is produced, and the time and space complexity of producing that result. Discuss practical implications when L is very large.
EasyTechnical
0 practiced
Given a list of tokens (strings), implement a Python function count_frequencies(tokens: List[str]) -> Dict[str, int] that returns a dictionary mapping each token to its count. Show two different implementations: one using a plain dict and one using collections.Counter. Discuss time and space complexity and when Counter is preferable.
HardTechnical
0 practiced
You must detect matching pairs whose sum equals target in a dataset too big to fit in memory (stored on disk). Describe approaches using external memory: sort-merge with streaming reads, hashing into buckets on disk, or bloom-filter pre-checks. Discuss tradeoffs in I/O, memory, and correctness.

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.