AlgoViz
HomeStrings

Strings

Characters are just arrays — two pointers, counts and parsing.

0/ 26 understood · 0%
Walkthroughs
13
Problems
26
Start here
26 shown
  1. Reverse StringSwap the ends, walk inwardEasy
  2. Longest Common PrefixShrink the candidate against each wordEasy
  3. Reverse Words in a StringSplit on spaces, reverse the orderMedium
  4. Roman to IntegerSubtract when a smaller numeral precedes a largerEasy
  5. String to Integer (atoi)Parse sign and digits, clamp to rangeMedium
  6. Practice problems
  7. Remove Outermost ParenthesesTrack depth; skip the outer layerMedium
  8. Reverse words in a given stringSplit on whitespace, reverse, rejoinMedium
  9. Largest Odd Number in a StringScan back to the last odd digitEasy
  10. Isomorphic StringThe mapping must work both waysEasy
  11. Rotate Stringb is a rotation iff it is a substring of a+aEasy
  12. Check if two strings are anagram of each otherSame letters, same countsEasy
  13. Sort Characters by FrequencyCount, then order by countEasy
  14. Maximum Nesting Depth of the ParenthesesA counter, and its high-water markMedium
  15. Count Number of SubstringsatMost(k) minus atMost(k-1)Easy
  16. Longest Palindromic SubstringExpand around every centreMedium
  17. Sum of Beauty of All SubstringsExtend each start, updating counts incrementallyMedium
  18. Reverse every word in a stringSame split, reverse and joinMedium
  19. Minimum number of bracket reversals to make an expression balancedCancel matched pairs, then pair up the restHard
  20. Count and sayDescribe the previous term out loudHard
  21. Hashing In StringsPolynomial hashing for O(1) substring compareEasy
  22. Rabin Karp AlgorithmRoll the hash along the textHard
  23. Z functionLongest match with the prefix at every indexHard
  24. KMP Algorithm or LPS arrayLPS tells you how far to fall backHard
  25. Shortest PalindromeFind the longest palindromic prefix with KMPHard
  26. Longest happy prefixThe last entry of the LPS arrayHard
  27. Count Palindromic SubsequencesInterval DP over start and endMedium