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
In Python, demonstrate with short code examples how append, extend, insert, and using the '+' operator behave differently on lists. For each operation, show sample input and output, state whether it mutates the original list, and give its amortized or worst-case time complexity in plain terms.
MediumTechnical
0 practiced
Explain how finding a subarray with a given sum differs for arrays with all positive numbers vs arrays that may contain negative numbers. For each case, describe the algorithm and core data structure you would use and explain why the approaches differ in complexity or correctness.
MediumTechnical
0 practiced
Group anagrams: given a list of lowercase words like ['eat','tea','tan','ate','nat','bat'], group them into lists of anagrams. Implement group_anagrams(words: List[str]) -> List[List[str]] in Python and explain the time complexity. Discuss an alternative key representation to sorting each word.
EasyTechnical
0 practiced
Write a Python function unique_preserve_order(lst) that returns a new list with duplicates removed while preserving the first occurrence order. Example: [3,1,2,3,2] -> [3,1,2]. Discuss time and space complexity and how Python 3.7+ insertion-ordered dicts help.
HardTechnical
0 practiced
You're tasked with computing frequency counts for billions of 64-bit event IDs arriving at high throughput but you have only a few GB of RAM. Propose a production-ready solution describing data structures (exact vs approximate), sharding, persistent storage, how to handle hot keys, and how to trade accuracy for memory and throughput.

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.