String Matching LeetCode Problems: All 20,
With Python Solutions

Every problem in this library that LeetCode tags String Matching. 16 of them carry a complete Python solution, a worked example and the time and space complexity of the approach.

Easy
8
Medium
5
Hard
7

String Matching problems by difficulty

Problems with a complete Python solution are listed first, then by ascending problem number.

Easy (8)

Easy problems
No.Problem
0028Find the Index of the First Occurrence in a String
0459Repeated Substring Pattern
0572Subtree of Another Tree
0796Rotate String
1408String Matching in an Array
1455Check If a Word Occurs As a Prefix of Any Word in a Sentence
1668Maximum Repeating Substring
2185Counting Words With a Given Prefix

Medium (5)

Medium problems
No.Problem
0686Repeated String Match
1023Camelcase Matching
1764Form Array by Concatenating Subarrays of Another Array
0616Add Bold Tag in StringPremium
0758Bold Words in StringPremium

Hard (7)

Hard problems
No.Problem
0214Shortest Palindrome
1392Longest Happy Prefix
2301Match Substring After Replacement
2430Maximum Deletions on a String
2851String Transformation
1397Find All Good Strings
2223Sum of Scores of Built Strings

Eyes only

When the String Matching problem arrives live.

In the live round, Stealth Interview reads the problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer says. It's a desktop app for macOS and Windows, invisible to screen sharing.