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 the costs of building a new string by repeatedly concatenating in Python (e.g., s += part in a loop) versus collecting parts in a list and using ' '.join(parts). Give an example loop to demonstrate the poor approach and then the efficient approach. State time and space costs and why one scales poorly for long sequences.
MediumTechnical
0 practiced
Implement a function longest_unique_substring(s: str) -> str that returns the longest substring without repeating characters. Use a sliding-window approach with a dictionary to track last-seen positions. Provide Python code and analyze time and space complexity.
EasyTechnical
0 practiced
Given the Python list:
L = [10, 20, 30, 40, 50]
Explain the result of each expression and why: L[1:4], L[-2:], L[:], L[::2], L[::-1]. For each expression state the returned value, whether a copy or view is produced, and the time and space complexity of producing that result. Discuss practical implications when L is very large.
HardTechnical
0 practiced
Design a memory-efficient approximate frequency counter for token streams (think Count-Min Sketch) when exact counts are too large to store. Describe data structures used, error guarantees, how hashes and multiple tables work, and when you'd prefer this over exact dictionaries during AI preprocessing.
EasyTechnical
0 practiced
Write a Python function two_sum(nums: List[int], target: int) -> Tuple[int, int] that returns indices (i, j) of two numbers such that nums[i] + nums[j] == target. Provide a single-pass hash map solution and explain why it is O(n) time and O(n) space. Mention edge cases (duplicates, same index) and how you'd handle them.

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.