String
substring()
isO(n)
Palindrome
validate
https://leetcode.com/problems/valid-palindrome/description/ https://leetcode.com/problems/palindrome-partitioning/description/ https://leetcode.com/problems/palindrome-permutation/description/ https://leetcode.com/problems/find-the-closest-palindrome/description/
central extention
key: 1) no need 2d table 2) 2 rounds: 1st round, aba; 2nd round, abba https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/palindromic-substrings/description/ https://leetcode.com/problems/palindrome-partitioning-ii/description/
dynamic programming
need 2d table https://leetcode.com/problems/longest-palindromic-subsequence/description/ https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/palindromic-substrings/description/ https://leetcode.com/problems/count-different-palindromic-subsequences/description/ key: 2 pointers
anagram/permutation
map char:counts
https://leetcode.com/problems/valid-anagram https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/find-all-anagrams-in-a-string https://leetcode.com/problems/permutation-in-string/description/ https://leetcode.com/problems/find-anagram-mappings
String & word dict
lookup words from string in dict:
https://leetcode.com/problems/word-ladder/description/ https://leetcode.com/problems/word-ladder-ii/description/ https://leetcode.com/problems/word-break/description/
lookup words from dict in string:
https://leetcode.com/problems/add-bold-tag-in-string/description/
Reverse string
toCharArray(), 2 pointers
trick: 1.reverse whole array -> 2. reverse partial array
https://leetcode.com/problems/reverse-words-in-a-string/description/ https://leetcode.com/problems/reverse-words-in-a-string-iii/description/ https://leetcode.com/problems/reverse-words-in-a-string-ii/description/ https://leetcode.com/problems/rotate-array/description/ https://leetcode.com/problems/reverse-vowels-of-a-string/description/ https://leetcode.com/problems/reverse-string-ii/description/ https://leetcode.com/problems/reverse-string/description/
https://jaywinhuang.gitbooks.io/leetcode/content/mySolutions/092-reverse-linked-list-ii.html https://jaywinhuang.gitbooks.io/leetcode/content/mySolutions/151-reverse-words-in-a-string.html https://jaywinhuang.gitbooks.io/leetcode/content/mySolutions/186-reverse-words-in-a-string-ii.html https://jaywinhuang.gitbooks.io/leetcode/content/mySolutions/189-rotate-array.html https://jaywinhuang.gitbooks.io/leetcode/content/mySolutions/206-reverse-linked-list.html
+ - * /
operations
+ - * /
operationsKey points: carry
curr % 10
curr / 10
Start from right end plus max length max(len1, len2) + 1
, multiply max length len1 + len2
https://leetcode.com/problems/add-binary https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/add-two-numbers-ii/description/ https://leetcode.com/problems/add-strings/description/ https://leetcode.com/problems/plus-one/description/ https://leetcode.com/problems/plus-one-linked-list/description/ https://leetcode.com/problems/multiply-strings
encode/decode/calculator
stack iterative and recursion thing in a parenthesis is a new recursion
https://leetcode.com/problems/decode-string https://leetcode.com/problems/number-of-atoms/description/ https://leetcode.com/problems/expression-add-operators/description/ https://leetcode.com/problems/evaluate-reverse-polish-notation/description/ https://leetcode.com/problems/parse-lisp-expression https://leetcode.com/problems/basic-calculator/description/
brute force
https://leetcode.com/problems/integer-to-roman/discuss/6274/Simple-Solution https://leetcode.com/problems/integer-to-english-words
word pattern
map+set https://leetcode.com/problems/isomorphic-strings/description/ https://leetcode.com/problems/word-pattern https://leetcode.com/problems/word-pattern-ii/description/
Word abbreviation
https://leetcode.com/problems/unique-word-abbreviation https://leetcode.com/problems/generalized-abbreviation https://leetcode.com/problems/valid-word-abbreviation https://leetcode.com/problems/minimum-unique-word-abbreviation https://leetcode.com/problems/word-abbreviation
Calculator / evaluate expression
Last updated