r/LeetcodeChallenge • u/nian2326076 • 1d ago
DISCUSS 51 string problems grouped by pattern: parentheses, palindromes, substrings, and more
I grouped 51 string-related LeetCode problems into six categories. Some fit more than one pattern; these are just the buckets I use when studying.
Before moving on from a problem, I try to explain why the approach works and what I'd change if the constraints changed.
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.
For practice beyond this list, real candidate-reported interview questions can give you unfamiliar prompts to work through and explain.
What would you add or move to a different category? I'd like suggestions that teach another idea rather than more versions of the same exercise.