Arrays, Strings, and Hashing Questions

Manipulating arrays and strings using the standard toolkit for entry-level coding-interview problems: two-pointer and sliding-window techniques, in-place modification (reversal, rotation, partitioning, deduplication), prefix sums, and hash-map or hash-set based techniques used to solve array or string problems in optimal time (frequency counting, lookup-based pairing such as two-sum, duplicate detection, grouping by a computed key such as anagram grouping). Hashing appears in this topic only as an applied technique for solving an array or string problem faster: how hash tables work internally (hash functions, collision resolution, load factor, resizing) and hash-based structures that are not array or string shaped (Bloom filters, HyperLogLog) belong to the separate hashing and hash tables topic, not this one. Covers the most frequent entry-level coding-interview problem shapes and the trade-offs between time, space, and readability. The default warm-up surface for any coding interview.

EasyTechnical
42 practiced

Write a recursive function flatten(nested: List[Any]) -> List[Any] in Python that flattens arbitrarily nested lists (e.g., [1, [2, [3, 4], 5], 6] -> [1,2,3,4,5,6]). Discuss recursion depth concerns for extremely nested input and provide an iterative alternative using an explicit stack.

EasyTechnical
34 practiced

Implement a streaming base64 decoder in Python that reads from an input stream (file-like object) and writes decoded bytes to an output stream without loading the entire input into memory. Handle padding, optional newlines/whitespace in input, and ensure constant extra memory proportional to block size (4 bytes).

MediumTechnical
30 practiced

Given a list of possibly unhashable Python objects (for example dictionaries representing tokens), design an algorithm to deduplicate while preserving original order. Discuss time/space trade-offs and how you would adapt for extremely large datasets that must be processed in chunks or streaming.

EasyTechnical
43 practiced

Implement the Boyer-Moore majority vote algorithm in Python to find the element that appears more than n/2 times in an array. Your solution should run in O(n) time and O(1) extra space. Explain why the algorithm finds a candidate and why a verification pass is needed.

EasyTechnical
43 practiced

Compare an array (contiguous memory) vs a singly linked list for these operations: random access, insert at head, insert at middle, delete, and iteration. Give big-O time complexities and concrete scenarios when you'd favor one over the other.

Unlock Full Question Bank

Get access to all Arrays, Strings, and Hashing interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.