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.

MediumTechnical
54 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
65 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.
EasyTechnical
64 practiced
Write a Python list comprehension that, given nums = list(range(1,21)), returns the squares of even numbers between 1 and 20 inclusive. Then rewrite it as a generator expression and explain when you'd prefer the generator over the list comprehension in data pipelines.
EasyTechnical
51 practiced
Demonstrate using a Python dict as a dispatch table to replace a switch/case. Given operations 'sum','mean','median' mapping to functions, show how to call the appropriate function based on a string key and handle unknown keys safely (provide fallback).
MediumTechnical
60 practiced
You have CSV rows (user_id, event_type, timestamp) read line-by-line. Without pandas, write Python code to group events by user_id into a dict where each value is a list of events sorted by timestamp. Then explain memory and time trade-offs when the file is large and how to process streaming data instead of loading everything.

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.