String LeetCode Problems: All 672,
With Python Solutions

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

Easy
196
Medium
335
Hard
141

String problems by difficulty

Showing the first 200 of 672 problems. Problems with a complete Python solution are listed first, then by ascending problem number.

Easy (55)

Easy problems
No.Problem
0013Roman to Integer
0014Longest Common Prefix
0020Valid Parentheses
0028Find the Index of the First Occurrence in a String
0058Length of Last Word
0067Add Binary
0125Valid Palindrome
0168Excel Sheet Column Title
0171Excel Sheet Column Number
0205Isomorphic Strings
0242Valid Anagram
0257Binary Tree Paths
0290Word Pattern
0344Reverse String
0345Reverse Vowels of a String
0383Ransom Note
0387First Unique Character in a String
0389Find the Difference
0392Is Subsequence
0405Convert a Number to Hexadecimal
0409Longest Palindrome
0412Fizz Buzz
0415Add Strings
0434Number of Segments in a String
0459Repeated Substring Pattern
0482License Key Formatting
0500Keyboard Row
0504Base 7
0520Detect Capital
0521Longest Uncommon Subsequence I
0541Reverse String II
0551Student Attendance Record I
0557Reverse Words in a String III
0599Minimum Index Sum of Two Lists
0657Robot Return to Origin
0680Valid Palindrome II
0696Count Binary Substrings
0709To Lower Case
0748Shortest Completing Word
0771Jewels and Stones
0796Rotate String
0804Unique Morse Code Words
0806Number of Lines To Write String
0819Most Common Word
0821Shortest Distance to a Character
0824Goat Latin
0830Positions of Large Groups
0844Backspace String Compare
0859Buddy Strings
0884Uncommon Words from Two Sentences
0917Reverse Only Letters
0925Long Pressed Name
0929Unique Email Addresses
0942DI String Match
0944Delete Columns to Make Sorted

Medium (100)

Medium problems
No.Problem
0003Longest Substring Without Repeating Characters
0005Longest Palindromic Substring
0006Zigzag Conversion
0008String to Integer (atoi)
0012Integer to Roman
0017Letter Combinations of a Phone Number
0022Generate Parentheses
0038Count and Say
0043Multiply Strings
0049Group Anagrams
0071Simplify Path
0072Edit Distance
0079Word Search
0091Decode Ways
0093Restore IP Addresses
0097Interleaving String
0131Palindrome Partitioning
0139Word Break
0151Reverse Words in a String
0165Compare Version Numbers
0166Fraction to Recurring Decimal
0179Largest Number
0187Repeated DNA Sequences
0208Implement Trie (Prefix Tree)
0211Design Add and Search Words Data Structure
0227Basic Calculator II
0241Different Ways to Add Parentheses
0299Bulls and Cows
0306Additive Number
0316Remove Duplicate Letters
0318Maximum Product of Word Lengths
0331Verify Preorder Serialization of a Binary Tree
0385Mini Parser
0388Longest Absolute File Path
0394Decode String
0395Longest Substring with At Least K Repeating Characters
0399Evaluate Division
0402Remove K Digits
0423Reconstruct Original Digits from English
0424Longest Repeating Character Replacement
0433Minimum Genetic Mutation
0438Find All Anagrams in a String
0443String Compression
0449Serialize and Deserialize BST
0451Sort Characters By Frequency
0467Unique Substrings in Wraparound String
0468Validate IP Address
0474Ones and Zeroes
0481Magical String
0516Longest Palindromic Subsequence
0522Longest Uncommon Subsequence II
0524Longest Word in Dictionary through Deleting
0535Encode and Decode TinyURL
0537Complex Number Multiplication
0539Minimum Time Difference
0556Next Greater Element III
0567Permutation in String
0583Delete Operation for Two Strings
0592Fraction Addition and Subtraction
0606Construct String from Binary Tree
0609Find Duplicate File in System
0640Solve the Equation
0647Palindromic Substrings
0648Replace Words
0649Dota2 Senate
0676Implement Magic Dictionary
0677Map Sum Pairs
0678Valid Parenthesis String
0686Repeated String Match
0692Top K Frequent Words
0712Minimum ASCII Delete Sum for Two Strings
0720Longest Word in Dictionary
0721Accounts Merge
0722Remove Comments
0752Open the Lock
0756Pyramid Transition Matrix
0763Partition Labels
0767Reorganize String
0777Swap Adjacent in LR String
0784Letter Case Permutation
0791Custom Sort String
0792Number of Matching Subsequences
0809Expressive Words
0811Subdomain Visit Count
0816Ambiguous Coordinates
0820Short Encoding of Words
0831Masking Personal Information
0833Find And Replace in String
0838Push Dominoes
0842Split Array into Fibonacci Sequence
0848Shifting Letters
0856Score of Parentheses
0880Decoded String at Index
0890Find and Replace Pattern
0893Groups of Special-Equivalent Strings
0916Word Subsets
0921Minimum Add to Make Parentheses Valid
0926Flip String to Monotone Increasing
0937Reorder Data in Log Files
0949Largest Time for Given Digits

Hard (45)

Hard problems
No.Problem
0010Regular Expression Matching
0030Substring with Concatenation of All Words
0032Longest Valid Parentheses
0044Wildcard Matching
0065Valid Number
0068Text Justification
0076Minimum Window Substring
0087Scramble String
0115Distinct Subsequences
0126Word Ladder II
0127Word Ladder
0132Palindrome Partitioning II
0140Word Break II
0212Word Search II
0214Shortest Palindrome
0224Basic Calculator
0273Integer to English Words
0282Expression Add Operators
0297Serialize and Deserialize Binary Tree
0301Remove Invalid Parentheses
0336Palindrome Pairs
0420Strong Password Checker
0466Count The Repetitions
0472Concatenated Words
0488Zuma Game
0514Freedom Trail
0564Find the Closest Palindrome
0591Tag Validator
0639Decode Ways II
0664Strange Printer
0691Stickers to Spell Word
0730Count Different Palindromic Subsequences
0736Parse Lisp Expression
0745Prefix and Suffix Search
0761Special Binary String
0828Count Unique Characters of All Substrings of a Given String
0839Similar String Groups
0854K-Similar Strings
0899Orderly Queue
0902Numbers At Most N Given Digit Set
0903Valid Permutations for DI Sequence
0906Super Palindromes
0936Stamping The Sequence
0940Distinct Subsequences II
0943Find the Shortest Superstring

Eyes only

When the String 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.