Microsoft String Coding Interview Questions
161 string coding problems are tagged as asked at Microsoft in interviews and online assessments reported by candidates. By difficulty they split into 57 basic, 78 intermediate and 26 advanced. The topics they most often combine with are Math, Hash Table, Two Pointers, Stack.
Reported questions change over time and are not a guarantee of what you will be asked, so use the list to see which patterns Microsoft tends to test. For each problem, practise explaining your approach, its time and space cost and the edge cases before you write the code; every problem opens in an editor that runs your code against test cases.
Coding problems
- Valid Parentheses (Basic)
- Longest Substring Without Repeats (Intermediate)
- Reverse String (Basic)
- First Unique Character (Basic)
- Valid Palindrome (Basic)
- Decode Ways (Intermediate)
- Longest Palindromic Substring (Intermediate)
- Valid Anagram (Basic)
- Ransom Note (Basic)
- Repeated Substring Pattern (Intermediate)
- Reverse Words in a String (Basic)
- Reverse Vowels of a String (Basic)
- Roman to Integer (Intermediate)
- Excel Column Number (Basic)
- Add Binary (Basic)
- Length of Last Word (Basic)
- Longest Common Subsequence (Advanced)
- Edit Distance (Advanced)
- Longest Valid Parentheses (Advanced)
- Greatest Common Divisor of Strings (Intermediate)
- Partition Labels (Intermediate)
- Sort Characters by Frequency (Intermediate)
- Remove Outer Parentheses (Basic)
- Shortest Distance to a Character (Intermediate)
- Maximum Number of Balloons (Basic)
- Remove Invalid Parentheses (Intermediate)
- Valid Parenthesis With Wildcards (Advanced)
- Is Subsequence (Basic)
- Minimum Time to Make Rope Colorful (Intermediate)
- Minimum Deletions for Unique Frequencies (Intermediate)
- Permutation Inside a String (Intermediate)
- Zigzag Conversion (Intermediate)
- Remove K Digits to Get the Smallest Number (Intermediate)
- Compare Version Numbers (Intermediate)
- Count Palindromic Substrings (Intermediate)
- Longest Substring With At Most K Letters (Intermediate)
- Longest Palindromic Subsequence (Intermediate)
- Isomorphic Strings (Basic)
- Minimum Window Substring (Advanced)
- Shortest Palindrome (Advanced)
- Rotate String (Basic)
- Length of Last Word (Basic)
- Add Strings (Basic)
- Reconstruct Itinerary (Advanced)
- Text Justification (Intermediate)
- Palindrome Linked List (Basic)
- Zigzag Level Order Traversal (Intermediate)
- Level Order Traversal (Basic)
- Open the Lock (Intermediate)
- Minimum Genetic Mutation (Intermediate)
- Smallest String With Swaps (Intermediate)
- Regions Cut by Slashes (Intermediate)
- Alien Dictionary Order (Advanced)
- Interleaving String (Intermediate)
- Regular Expression Matching (Advanced)
- Longest String Chain (Intermediate)
- Strange Printer (Advanced)
- Longest Ideal Subsequence (Intermediate)
- Maximum Students Taking Exam (Advanced)
- Two Keys Keyboard (Intermediate)
- Count Number of Texts (Intermediate)
- Count Ways to Build Good Strings (Intermediate)
- Find First Occurrence (Basic)
- Longest Happy Prefix (Intermediate)
- Repeated String Match (Intermediate)
- String Compression (Basic)
- Valid Number (Advanced)
- String to Integer (Intermediate)
- Multiply Strings (Intermediate)
- Integer to English Words (Advanced)
- Replace Words (Intermediate)
- Word Search (Intermediate)
- Word Search II Count (Advanced)
- Custom Sort String (Basic)
- Determine if Two Strings Are Close (Intermediate)
- Count Binary Substrings (Basic)
- Goat Latin (Basic)
- Number of Matching Subsequences (Intermediate)
- Minimum Steps to Make Two Strings Anagram (Basic)
- Sum of Beauty of All Substrings (Intermediate)
Related
- Microsoft coding interview questions
- String problems
- Microsoft basic problems
- Microsoft intermediate problems
- Microsoft advanced problems
- Company interview roadmaps
- All interview guides
Frequently asked questions
How should I use the Microsoft problem list?
Start with the basic problems, then the intermediate and advanced ones, and note which topics repeat. Solve each under a timer, then read the explanation.
Are these the exact Microsoft interview questions?
They are problems candidates reported being asked. Companies rotate questions, so use them to learn the patterns, not to predict the exact question.