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.

HardTechnical
0 practiced
For a high-throughput in-memory queue used by a multi-threaded ingestion pipeline in Python, evaluate using list (with pop(0)), collections.deque, and a custom linked-list or ring buffer. Discuss time complexities, memory overheads, Python GIL implications, thread-safety primitives to use, and recommend the best choice explaining why.
HardTechnical
0 practiced
Implement an LRU cache in Python with O(1) get and put operations. The cache has fixed capacity, evicts least-recently-used item on overflow, and supports updating existing keys. Do not use OrderedDict; implement the underlying doubly-linked list + hashmap approach and explain complexity.
HardSystem Design
0 practiced
Design a substring-frequency index for a corpus that supports queries: 'how many times does substring S (|S| ≤ L) appear across documents?'. Compare data-structure choices (n-gram dictionary, trie, suffix array, inverted index), discuss memory/time trade-offs, update cost, and provide a high-level construction algorithm using dictionaries for n-grams up to length L.
HardTechnical
0 practiced
Implement an algorithm to find the longest palindromic substring in a given input string. Explain the trade-offs between expanding-around-center (O(n^2)) and Manacher's algorithm (O(n)). Provide a working Python implementation for your chosen approach and explain why it meets the stated complexity.
HardTechnical
0 practiced
Given a list of characters representing a string with true length L and sufficient buffer at the end, implement in-place URLify that replaces all spaces with '%20'. Example: list('Mr John Smith '), L=13 -> list('Mr%20John%20Smith'). Use only O(1) extra space and explain your approach.

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.