InterviewStack.io LogoInterviewStack.io

Arrays, Strings & Hashing Questions

Solve problems involving array manipulation, string operations, and hash tables. Common topics include two-pointer techniques, sliding windows, prefix sums, and hash map usage. Practice problems on LeetCode with difficulty 'easy' to 'medium.' Focus on understanding why these data structures are used and what their trade-offs are.

HardTechnical
30 practiced
Implement Rabin-Karp rolling-hash substring search: write `rabin_karp(text: str, pattern: str) -> List[int]` in Python that returns starting indices where pattern occurs in text. Explain how rolling hash reduces per-shift cost, how to handle collisions, and how to choose base and modulus for typical ASCII/UTF-8 strings.
EasyTechnical
36 practiced
You process log messages and need to find the first non-repeating character in each message to identify unique markers. Given a string s, implement `first_unique_char(s: str) -> int` that returns the index of the first character that appears only once, or -1 if none. Use Python and aim for O(n) time. Example: s = 'swiss' -> index 0 ('s' occurs multiple times then 'w' -> index 1).
MediumTechnical
39 practiced
You need to extract the smallest window from raw logs that contains all critical error codes listed in set T. Given strings S and T, implement `min_window(S: str, T: str) -> str` in Python to return the minimum substring of S that contains all characters from T (including multiplicity). Explain algorithmic complexity. Example: S='ADOBECODEBANC', T='ABC' -> 'BANC'.
EasyTechnical
37 practiced
As part of data normalization, you must detect whether two product SKUs are anagrams (same characters, different order). Implement `is_anagram(s: str, t: str) -> bool` in Python. Consider ASCII alphanumerics and case sensitivity should be configurable. Explain time and space complexity and show an example: s = 'listen', t = 'silent' -> True.
HardTechnical
35 practiced
Implement a Count-Min Sketch class in Python that supports `add(item)` and `estimate(item)` operations for approximate frequency queries over a stream. Explain how to choose width and depth for given error (epsilon) and failure probability (delta), how hashing is used to map items, and how to merge two sketches from different partitions.

Unlock Full Question Bank

Get access to hundreds of Arrays, Strings & Hashing interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.