InterviewStack.io LogoInterviewStack.io

Arrays, Strings, and Collections Fundamentals Questions

Core knowledge of linear data structures and common collection types and the techniques used to manipulate them. Covers arrays and strings operations such as iteration, indexing, in place modification, reversing, rotating, two pointer techniques, sliding window patterns, searching and basic sorting approaches for these containers, and typical interview problems like finding duplicates and subarray or substring problems. Also covers collection types such as lists, sets, dictionaries and hash tables, when to use each, loop constructs and recursion for traversal, and basic time and space complexity reasoning to choose appropriate data structures and algorithms.

HardTechnical
53 practiced
Given a large multilingual corpus, implement a robust tokenizer normalization function that: (1) normalizes Unicode (NFC/NFKC), (2) strips control characters, (3) maps whitespace to a single space, and (4) returns both tokenized text and a mapping from token index back to original character offsets. Explain why maintaining offsets matters for downstream annotation tasks.
HardTechnical
44 practiced
Given a long array of floating activations from a model run, design an efficient algorithm to detect plateau regions where values remain within epsilon for at least L consecutive positions (useful for detecting saturation or vanishing gradients). Provide an O(n) algorithm and discuss numerical stability for floats and noise tolerance.
HardSystem Design
53 practiced
You need to batch and pad variable-length token sequences efficiently for training. Design data structures and an algorithm to create padded batches that minimize padding tokens while supporting fast tensor creation on GPU. Discuss bucketing, sorting by length, ragged tensors, and the trade-offs for shuffling and convergence in training.
HardTechnical
39 practiced
Design a weighted reservoir sampling algorithm to sample k items from an unbounded stream where each item has a positive weight and selection probability should be proportional to weight. Provide the algorithm, prove correctness at high level, and discuss numerical stability when weights vary by many orders of magnitude.
MediumTechnical
43 practiced
Given two strings s and p, implement a function find_anagrams(s: str, p: str) -> List[int] in Python that returns starting indices of p's anagrams in s. Use a sliding-window and frequency counts to achieve O(n) time. Explain how this sliding-window pattern is analogous to finding n-gram matches in token streams.

Unlock Full Question Bank

Get access to hundreds of Arrays, Strings, and Collections Fundamentals interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.