# String Matching DSA Problems

> 36 String Matching coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/string-matching
Last updated: 2026-11-28

36 string matching problems for coding interviews and campus placements, with hints and company tags. Below are all 36: 10 easy, 11 medium and 15 hard. Practise them free on InternHack and track what you have solved.

## String Matching problems, easiest first

1. [Check If a Word Occurs As a Prefix of Any Word in a Sentence](https://www.internhack.in/learn/dsa/problem/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence) (Easy)
2. [Count Prefix and Suffix Pairs I](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-i) (Easy)
3. [Counting Words With a Given Prefix](https://www.internhack.in/learn/dsa/problem/counting-words-with-a-given-prefix) (Easy)
4. [Find the Index of the First Occurrence in a String](https://www.internhack.in/learn/dsa/problem/find-the-index-of-the-first-occurrence-in-a-string) (Easy)
5. [Maximum Repeating Substring](https://www.internhack.in/learn/dsa/problem/maximum-repeating-substring) (Easy)
6. [Repeated Substring Pattern](https://www.internhack.in/learn/dsa/problem/repeated-substring-pattern) (Easy)
7. [Rotate String](https://www.internhack.in/learn/dsa/problem/rotate-string) (Easy)
8. [String Matching in an Array](https://www.internhack.in/learn/dsa/problem/string-matching-in-an-array) (Easy)
9. [Substring Matching Pattern](https://www.internhack.in/learn/dsa/problem/substring-matching-pattern) (Easy)
10. [Subtree of Another Tree](https://www.internhack.in/learn/dsa/problem/subtree-of-another-tree) (Easy)
11. [Add Bold Tag in String](https://www.internhack.in/learn/dsa/problem/add-bold-tag-in-string) (Medium)
12. [Bold Words in String](https://www.internhack.in/learn/dsa/problem/bold-words-in-string) (Medium)
13. [Camelcase Matching](https://www.internhack.in/learn/dsa/problem/camelcase-matching) (Medium)
14. [Count Cells in Overlapping Horizontal and Vertical Substrings](https://www.internhack.in/learn/dsa/problem/count-cells-in-overlapping-horizontal-and-vertical-substrings) (Medium)
15. [Find Beautiful Indices in the Given Array I](https://www.internhack.in/learn/dsa/problem/find-beautiful-indices-in-the-given-array-i) (Medium)
16. [Find Pattern in Infinite Stream I](https://www.internhack.in/learn/dsa/problem/find-pattern-in-infinite-stream-i) (Medium)
17. [Form Array by Concatenating Subarrays of Another Array](https://www.internhack.in/learn/dsa/problem/form-array-by-concatenating-subarrays-of-another-array) (Medium)
18. [Minimum Number of Valid Strings to Form Target I](https://www.internhack.in/learn/dsa/problem/minimum-number-of-valid-strings-to-form-target-i) (Medium)
19. [Minimum Time to Revert Word to Initial State I](https://www.internhack.in/learn/dsa/problem/minimum-time-to-revert-word-to-initial-state-i) (Medium)
20. [Number of Subarrays That Match a Pattern I](https://www.internhack.in/learn/dsa/problem/number-of-subarrays-that-match-a-pattern-i) (Medium)
21. [Repeated String Match](https://www.internhack.in/learn/dsa/problem/repeated-string-match) (Medium)
22. [Count Prefix and Suffix Pairs II](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-ii) (Hard)
23. [Find All Good Strings](https://www.internhack.in/learn/dsa/problem/find-all-good-strings) (Hard)
24. [Find Beautiful Indices in the Given Array II](https://www.internhack.in/learn/dsa/problem/find-beautiful-indices-in-the-given-array-ii) (Hard)
25. [Find Pattern in Infinite Stream II](https://www.internhack.in/learn/dsa/problem/find-pattern-in-infinite-stream-ii) (Hard)
26. [Find the Occurrence of First Almost Equal Substring](https://www.internhack.in/learn/dsa/problem/find-the-occurrence-of-first-almost-equal-substring) (Hard)
27. [Lexicographically Smallest Generated String](https://www.internhack.in/learn/dsa/problem/lexicographically-smallest-generated-string) (Hard)
28. [Longest Happy Prefix](https://www.internhack.in/learn/dsa/problem/longest-happy-prefix) (Hard)
29. [Match Substring After Replacement](https://www.internhack.in/learn/dsa/problem/match-substring-after-replacement) (Hard)
30. [Maximum Deletions on a String](https://www.internhack.in/learn/dsa/problem/maximum-deletions-on-a-string) (Hard)
31. [Minimum Time to Revert Word to Initial State II](https://www.internhack.in/learn/dsa/problem/minimum-time-to-revert-word-to-initial-state-ii) (Hard)
32. [Number of Subarrays That Match a Pattern II](https://www.internhack.in/learn/dsa/problem/number-of-subarrays-that-match-a-pattern-ii) (Hard)
33. [Shortest Matching Substring](https://www.internhack.in/learn/dsa/problem/shortest-matching-substring) (Hard)
34. [Shortest Palindrome](https://www.internhack.in/learn/dsa/problem/shortest-palindrome) (Hard)
35. [String Transformation](https://www.internhack.in/learn/dsa/problem/string-transformation) (Hard)
36. [Sum of Scores of Built Strings](https://www.internhack.in/learn/dsa/problem/sum-of-scores-of-built-strings) (Hard)

## Companies that ask string matching problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 22 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 15 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 13 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 12 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 11 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 6 of these problems
- [Autodesk](https://www.internhack.in/learn/dsa/companies/autodesk): 4 of these problems
- [TCS](https://www.internhack.in/learn/dsa/companies/tcs): 3 of these problems
- [Capital ONE](https://www.internhack.in/learn/dsa/companies/capital-one): 3 of these problems
- [Visa](https://www.internhack.in/learn/dsa/companies/visa): 3 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 3 of these problems
- [Pocket Gems](https://www.internhack.in/learn/dsa/companies/pocket-gems): 2 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
