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 how dictionary insertion and lookup work conceptually in Python (hash table). Describe average and worst-case time complexity for insertion, lookup, and deletion. Mention how Python's insertion-order guarantee (since 3.7) affects iteration and any caveats for AI data pipelines that rely on deterministic ordering.
MediumTechnical
0 practiced
Explain how repeated slicing (e.g., s = s[1:] in a loop) can lead to quadratic behavior for strings/lists. Show an example of bad code and refactor it to an efficient linear-time version. Discuss implications when preprocessing very large text corpora for AI training.
MediumTechnical
0 practiced
Write a function merge_sorted(a: List[int], b: List[int]) -> List[int] that merges two sorted lists into a single sorted list using two pointers. Provide in-place strategies when possible, explain time and space complexity, and discuss when you might prefer to allocate a new list vs merge in-place for memory constraints.
MediumTechnical
0 practiced
Implement an in-place list reversal function in Python: reverse_inplace(arr: List[T]) -> None that reverses arr without creating another list. Do not use built-in reverse() or slicing tricks. Explain why your solution is O(n) time and O(1) extra space, and demonstrate with an example.
HardTechnical
0 practiced
Design an efficient way to chunk large text inputs into token-length-bounded segments for a generative model, ensuring you don't split important tokens (e.g., splitting on whitespace or subword token boundaries). Describe data structures you'd use to map from character indices to token indices and how dictionaries/lists come into play in the implementation.

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.