Arrays & Strings Interview Questions & Solutions
29 solutions ยท 12 Easy ยท 16 Medium ยท 1 Hard
Arrays and strings are where nearly every coding interview begins, and where sloppy fundamentals get exposed fastest. These problems look easy and often are โ but interviewers watch closely for whether you handle edge cases (empty input, single element, duplicates), whether you mutate in place when asked, and whether you reach for an O(n) prefix-sum or hash trick instead of a lazy O(nยฒ) double loop.
The solutions here build exactly those instincts. You'll work through prefix sums and running aggregates, in-place rearrangement and rotation, interval merging, and the string manipulation and parsing problems that trip people up under pressure. Each walkthrough is explicit about the time and space trade-offs, because "it works" is rarely enough in an interview โ the follow-up is always "can you do it faster, or without the extra array?" Get fluent here and the harder two-pointer, sliding-window, and hashing patterns will feel like natural extensions rather than new material.
- Find Numbers with Even Number of DigitsEasy
- Find Pivot IndexEasy
- Find the Index of the First Occurrence in a StringEasy
- First Unique Character in a StringEasy
- Greatest Common Divisor of StringsEasy
- Largest Odd Number in StringEasy
- Longest Common PrefixEasy
- Maximum Number of Words Found in SentencesEasy
- Move ZeroesEasy
- Plus OneEasy
- Running Sum of 1d ArrayEasy
- Valid Mountain ArrayEasy
- Contiguous ArrayMedium
- Find All Duplicates in an ArrayMedium
- Gas StationMedium
- Increasing Triplet SubsequenceMedium
- Insert IntervalMedium
- Integer to RomanMedium
- Largest NumberMedium
- Merge IntervalsMedium
- Multiply StringsMedium
- Next PermutationMedium
- Number of Good Ways to Split a StringMedium
- Reverse Words in a StringMedium
- Set Matrix ZeroesMedium
- Shortest Unsorted Continuous SubarrayMedium
- Subarray Sum Equals KMedium
- Sum of Absolute Differences in a Sorted ArrayMedium
- CandyHard
Practice Arrays & Strings the right way
SkillFlow serves you Arrays & Strings problems matched to your level, times you like a real interview, and tracks your proficiency as it climbs. Free.
Start practicing free โ