InterviewStack.io LogoInterviewStack.io

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
37 practiced

You are given an array of n+1 integers where each value is between 1 and n (inclusive). Prove and implement an algorithm to find a duplicate value in O(n) time and O(1) extra space without modifying the array. (Hint: use cycle detection/floyd's algorithm treating indices as pointers.)

MediumTechnical
32 practiced

Write a function in Python that parses a hex-encoded string into bytes. The function should accept an optional '0x' prefix, be case-insensitive, validate even length, and raise informative errors for invalid characters. Describe how to optimize this for parsing very large hex dumps (vectorized operations, chunking, C extensions).

EasyTechnical
38 practiced

Implement Kadane's algorithm in Java or Python to compute the maximum subarray sum (contiguous) for a given integer array. Your implementation should handle empty arrays and arrays with all negative numbers correctly and run in O(n) time using O(1) extra space. Explain how to return both the max sum and the subarray indices.

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.

MediumTechnical
44 practiced

Write an implementation of Kadane's algorithm in Python that returns both the maximum subarray sum and the start/end indices of that subarray. Explain edge cases (all negative numbers) and how you'd modify the approach to return the maximum subarray product instead.

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.