InterviewStack.io LogoInterviewStack.io

Core Data Structures Questions

Fundamental built-in data structures used in everyday programming and coding interviews: arrays/lists, strings, and hash maps (dictionaries). For array-like sequences, cover indexing, slicing or sub-ranging, iteration, common mutation operations (appending, inserting, removing elements), common algorithms such as sorting and reversing, and the memory and performance implications of each. For strings, cover indexing, slicing or substring extraction, common operations such as splitting, joining, trimming, and replacing, and general approaches to string manipulation and pattern processing. For hash maps and dictionaries, cover key value semantics, insertion and lookup, iteration patterns, safe access idioms (defaults, existence checks), and using hash tables for counting and grouping. Candidates should know the time complexity of common operations in plain terms (constant time, linear time, quadratic time) and be able to choose the appropriate structure for a problem and reason about space and performance tradeoffs. Practice should include implementation level manipulation exercises and classic interview problems such as two sum and frequency counting, written clearly in whatever language the candidate is most comfortable with (a specific language may be used for concrete code examples without the underlying concept being tied to it).

EasyTechnical
48 practiced
Given a list of strings in Python, implement a function that returns a dictionary mapping each unique string to its frequency count. The function should be memory- and time-efficient for moderate lists (millions of items). Show code and explain complexity. Example input: ['a','b','a','c','b','a'] -> {'a':3, 'b':2, 'c':1}.
MediumTechnical
85 practiced
Implement a Python function that returns sliding windows of size k over an iterable without materializing the entire sequence. Each window should be returned as a tuple. Example: iterable [1,2,3,4], k=3 -> (1,2,3), (2,3,4). The function should work for generators and large inputs.
HardTechnical
47 practiced
Find the longest palindromic substring of a given string. First describe a dynamic programming (O(n^2)) approach using a 2D table, then implement a more practical expand-around-center approach (O(n^2) time, O(1) space). Optionally outline Manacher's O(n) algorithm at a high level.
MediumTechnical
62 practiced
Group anagrams: given a list of strings, return a list of groups where each group contains anagrams. Implement in Python and discuss different ways to build the grouping key (sorted string vs character count) and their trade-offs for very long strings.
EasyTechnical
47 practiced
Implement an in-place function in Python that reverses a list of integers without using built-in reverse() or creating a new list. Your function should run in O(n) time and use O(1) extra space. Provide example usage and handle empty lists. Example:
python
lst = [1, 2, 3, 4]
reverse_in_place(lst)
# lst -> [4, 3, 2, 1]

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.