Advanced String Problems for Coding Interviews
93 advanced String problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 0 intermediate and 93 advanced. The companies that ask them most often are Google, Amazon, Meta, Microsoft.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Longest Common Subsequence (Advanced)
- Edit Distance (Advanced)
- Palindrome Partitioning Min Cuts (Advanced)
- Longest Valid Parentheses (Advanced)
- Largest Number From Digits (Advanced)
- Valid Parenthesis With Wildcards (Advanced)
- Minimum Window Substring (Advanced)
- Palindrome Partitioning Min Cuts (Advanced)
- Shortest Palindrome (Advanced)
- Count Subsequence Occurrences (Advanced)
- Minimum Number of Reflections (Advanced)
- Reconstruct Itinerary (Advanced)
- Shortest Path Through Maze Keys and Doors (Advanced)
- Prefix Sum Map (Advanced)
- IP Longest Prefix Match (Advanced)
- Message Retry With Dead Letter (Advanced)
- Similar String Groups (Advanced)
- Alien Dictionary Order (Advanced)
- Largest Color Value in a Directed Graph (Advanced)
- Regular Expression Matching (Advanced)
- Scramble String (Advanced)
- Student Attendance Record Count (Advanced)
- Freedom Trail (Advanced)
- Strange Printer (Advanced)
- Count Distinct Palindromic Subsequences (Advanced)
- Lexicographically Smallest Shortest Supersequence (Advanced)
- Maximum Students Taking Exam (Advanced)
- Shortest Superstring Length (Advanced)
- Longest Duplicate Substring (Advanced)
- Distinct Echo Substrings (Advanced)
- Sum of Scores of Built Strings (Advanced)
- Valid Number (Advanced)
- Integer to English Words (Advanced)
- Word Search II Count (Advanced)
- Palindrome Pairs Count (Advanced)
- Orderly Queue (Advanced)
- Count Unique Characters of All Substrings (Advanced)
- Decoded String at Index (Advanced)
- Basic Calculator (Advanced)
- Remove Duplicate Letters (Advanced)
- Substring With Concatenation of All Words (Advanced)
- Sudoku Solver (Advanced)
- Word Break II (Advanced)
- Expression Add Operators (Advanced)
- De Bruijn Sequence (Advanced)
- Manacher Palindrome Radii (Advanced)
- Suffix Array Construction (Advanced)
- Burrows-Wheeler Transform (Advanced)
- Aho-Corasick Pattern Count (Advanced)
- Stickers to Spell Word (Advanced)
- Palindrome Removal (Advanced)
- Number of Beautiful Partitions (Advanced)
- Count Palindromic Subsequences of Length 5 (Advanced)
- Ways to Separate Numbers (Advanced)
- Restore the Array From Digits (Advanced)
- Ways to Wear Different Hats (Advanced)
- Smallest Sufficient Team (Advanced)
- Zuma Game (Advanced)
- Minimum Distance to Type With Two Fingers (Advanced)
- Encode String With Shortest Length (Advanced)
- Paths With Max Score (Advanced)
- Minimum White Tiles After Carpets (Advanced)
- Delete Columns to Make Sorted III (Advanced)
- Longest Chunked Palindrome Decomposition (Advanced)
- DI String Valid Permutations (Advanced)
- Count Distinct Subsequences (Advanced)
- Minimum Window Subsequence (Advanced)
- Number of Wonderful Substrings (Advanced)
- Longest Awesome Substring (Advanced)
- Minimal String Rotation (Advanced)
- Last Substring in Lexicographical Order (Advanced)
- Count Distinct Substrings (Advanced)
- Strong Password Checker (Advanced)
- Tag Validator (Advanced)
- Parse Lisp Expression (Advanced)
- Number of Atoms (Advanced)
- Brace Expansion II (Advanced)
- Basic Calculator III (Advanced)
- Parsing a Boolean Expression (Advanced)
- Robot Printing the Smallest String (Advanced)
Related
Frequently asked questions
How do I get good at string problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run string problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.