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.

MediumTechnical
42 practiced

In an SRE environment you observe a Python service allocating many temporary strings and causing GC pressure. Describe concrete methods to profile string allocations (tracing allocators, memory profilers), identify hotspots, and reduce allocations using techniques like bytearray/memoryview, io.StringIO, preallocated buffers, pooling, or moving hot paths to languages with different allocation/escape analysis (Go). Provide metrics you'd collect to demonstrate improvement.

EasyTechnical
39 practiced

Implement remove_element(nums, val) in-place in Python or Java: remove all occurrences of val from nums and return the new length. This is part of a backend cleanup job where payload arrays must be compacted before storage. Explain how to move elements and whether order must be preserved.

EasyTechnical
43 practiced

Implement string_to_int(s) (atoi) in Java or Python for backend input parsing: trim leading/trailing spaces, handle optional '+' or '-', parse digits until non-digit, and clamp to 32-bit signed integer range. Explain how you detect overflow without using big-integer libraries and how you treat invalid inputs.

MediumTechnical
31 practiced

Find all start indices of p's anagrams in s. Given strings s and p, return a list of starting indices of p's anagrams in s. Example: s = 'cbaebabacd', p = 'abc' -> [0,6]. Implement in Python using sliding window + frequency arrays in O(n) time. Explain applications for substring pattern detection in tokenized text.

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.