string

006.ZigZag-Conversionarrow-up-right (M+) 336.Palindrome-Pairsarrow-up-right (H-) 388.Longest-Absolute-File-Patharrow-up-right (M+) 408.Valid-Word-Abbreviationarrow-up-right (M) 411.Minimum-Unique-Word-Abbreviation (H) 418.Sentence-Screen-Fittingarrow-up-right (M+) 423.Reconstruct-Original-Digits-from-Englisharrow-up-right (H-) 527.Word-Abbreviationarrow-up-right (M+) 556.Next Greater Element IIIarrow-up-right (H-) 616.Add-Bold-Tag-in-String (M) 467.Unique-Substrings-in-Wraparound-Stringarrow-up-right (H-) 564.Find-the-Closest-Palindromearrow-up-right (H) 722.Remove-Comments (H) 736.Parse-Lisp-Expressionarrow-up-right (H-) 816.Ambiguous-Coordinatesarrow-up-right (M+) 844.Backspace-String-Comparearrow-up-right (M+) 1616.Split-Two-Strings-to-Make-Palindromearrow-up-right (M+) 1754.Largest-Merge-Of-Two-Stringsarrow-up-right (M+) 1849.Splitting-a-String-Into-Descending-Consecutive-Valuesarrow-up-right (M+)

Rolling Hash

1044.Longest-Duplicate-Substringarrow-up-right (H) 1062.Longest-Repeating-Substringarrow-up-right (H-) 1554.Strings-Differ-by-One-Characterarrow-up-right (H) 1698.Number-of-Distinct-Substrings-in-a-Stringarrow-up-right (H-) 1923.Longest-Common-Subpatharrow-up-right (H)

KMP

1392.Longest-Happy-Prefixarrow-up-right (H) 028.Implement-strStrarrow-up-right (H) 214.Shortest-Palindromearrow-up-right (H) 459.Repeated-Substring-Patternarrow-up-right (H) 572.Subtree-of-Another-Treearrow-up-right (H) 1367.Linked-List-in-Binary-Treearrow-up-right (H) 1397.Find All Good Strings (TBD) 1764.Form-Array-by-Concatenating-Subarrays-of-Another-Arrayarrow-up-right (H)

Manacher

005.Longest-Palindromic-Substringarrow-up-right (H) 214.Shortest-Palindromearrow-up-right (H) 647.Palindromic-Substringsarrow-up-right (M+) 1960.Maximum-Product-of-the-Length-of-Two-Palindromic-Substringsarrow-up-right (H)

Palindrome

  • Several ways to solve the Longest palindrome substring problem

    • DP-based solution: O(n^2) space and time, if need to storing palindrome result, this is always better (e.g. palindrome partitioning)

    • Start looping from middle: O(n^2) time

    • Manacher's algorithm: O(n) time, not generic enough.

  • https://expl.ai/APDFXTD

  • String corner cases:

    • Whether there will be overlapping

    • Whether sources/indexes will be sorted

Last updated