HomeStrings
Strings
Characters are just arrays — two pointers, counts and parsing.
26 shown
- Reverse StringSwap the ends, walk inwardanimatedEasy
- Longest Common PrefixShrink the candidate against each wordanimatedEasy
- Reverse Words in a StringSplit on spaces, reverse the orderanimatedMedium
- Roman to IntegerSubtract when a smaller numeral precedes a largeranimatedEasy
- String to Integer (atoi)Parse sign and digits, clamp to rangeanimatedMedium
- Practice problems
- Remove Outermost ParenthesesTrack depth; skip the outer layerMedium
- Reverse words in a given stringSplit on whitespace, reverse, rejoinanimatedMedium
- Largest Odd Number in a StringScan back to the last odd digitEasy
- Isomorphic StringThe mapping must work both waysEasy
- Rotate Stringb is a rotation iff it is a substring of a+aEasy
- Check if two strings are anagram of each otherSame letters, same countsanimatedEasy
- Sort Characters by FrequencyCount, then order by countEasy
- Maximum Nesting Depth of the ParenthesesA counter, and its high-water markMedium
- Count Number of SubstringsatMost(k) minus atMost(k-1)Easy
- Longest Palindromic SubstringExpand around every centreanimatedMedium
- Sum of Beauty of All SubstringsExtend each start, updating counts incrementallyanimatedMedium
- Reverse every word in a stringSame split, reverse and joinanimatedMedium
- Minimum number of bracket reversals to make an expression balancedCancel matched pairs, then pair up the restHard
- Count and sayDescribe the previous term out loudHard
- Hashing In StringsPolynomial hashing for O(1) substring compareEasy
- Rabin Karp AlgorithmRoll the hash along the textanimatedHard
- Z functionLongest match with the prefix at every indexanimatedHard
- KMP Algorithm or LPS arrayLPS tells you how far to fall backanimatedHard
- Shortest PalindromeFind the longest palindromic prefix with KMPHard
- Longest happy prefixThe last entry of the LPS arrayHard
- Count Palindromic SubsequencesInterval DP over start and endMedium