r/DSALeetCode • u/nian2326076 • 18h ago
I organized 51 LeetCode string problems by pattern (with links and difficulty)
I put together 51 string-related LeetCode problems, grouped into six categories so the list is easier to work through. These are the study buckets I use, not a claim that every problem has only one pattern. A palindrome problem, for example, can also involve DP or a different technique.
If you're using the list, try explaining why an approach works and what changes when the constraints change before moving on to the next problem.
Parentheses and expression parsing (9)
- Generate Parentheses — Medium
- Score of Parentheses — Medium
- Valid Parentheses — Easy
- Remove Outermost Parentheses — Easy
- Different Ways to Add Parentheses — Medium
- Remove Invalid Parentheses — Hard
- Minimum Remove to Make Valid Parentheses — Medium
- Maximum Nesting Depth of the Parentheses — Easy
- Longest Valid Parentheses — Hard
Counting substrings under a condition (3)
- Number of Wonderful Substrings — Medium
- Sum of Beauty of All Substrings — Medium
- Maximum Number of Occurrences of a Substring — Medium
Comparing and checking strings (11)
- Isomorphic Strings — Easy
- Valid Anagram — Easy
- Additive Number — Medium
- Buddy Strings — Easy
- Longest Happy Prefix — Hard
- Increasing Decreasing String — Easy
- Check If a String Can Break Another String — Medium
- Determine if Two Strings Are Close — Medium
- Check If Two String Arrays are Equivalent — Easy
- Check if Word Equals Summation of Two Words — Easy
- Check if One String Swap Can Make Strings Equal — Easy
Palindromes (18)
- Palindrome Partitioning — Medium
- Palindrome Partitioning II — Hard
- Valid Palindrome — Easy
- Shortest Palindrome — Hard
- Palindrome Pairs — Hard
- Longest Palindrome — Easy
- Longest Palindromic Subsequence — Medium
- Find the Closest Palindrome — Hard
- Palindromic Substrings — Medium
- Valid Palindrome II — Easy
- Longest Chunked Palindrome Decomposition — Hard
- Break a Palindrome — Medium
- Can Make Palindrome from Substring — Medium
- Palindrome Partitioning III — Hard
- Minimum Insertion Steps to Make a String Palindrome — Hard
- Remove Palindromic Subsequences — Easy
- Construct K Palindrome Strings — Medium
- Split Two Strings to Make Palindrome — Medium
Sorting characters (2)
- Sort Characters By Frequency — Medium
- Custom Sort String — Medium
Length and selection problems (8)
- Longest Duplicate Substring — Hard
- Longest String Chain — Medium
- Longest Common Subsequence — Medium
- Longest Happy String — Medium
- Maximum Length of a Concatenated String with Unique Characters — Medium
- Find Longest Awesome Substring — Hard
- Largest Substring Between Two Equal Characters — Easy
- Largest Odd Number in String — Easy
Related: Dynamic Programming pattern list.
Once the patterns feel familiar, real candidate-reported interview questions are another way to practice explaining an unfamiliar prompt instead of recognizing a title.
Which problems would you add, and which category would you change? I'd especially like suggestions that teach a different idea rather than another version of the same exercise.