When to use an algo:

Can I make one irreversible choice that's obviously safe and shrink the problem? :: greedy

Does the best choice depend on future choices? :: DP

Questions:

217. Contains Duplicate :: Make map while checking for duplicate Map Lookups

242. Valid Anagram :: Make Counter then detract from it <=0 is bad Counters

1. Two Sum :: a+b=target, which means a=target-b. Using this, if we make a map of the values, we are able to quickly check if a exists. Map Lookups

49. Group Anagrams :: Sort each string and use that as the grouping key Counters

347. Top K Frequent Elements :: Count values, sort by count, grab sorted[-k:] Counters

238. Product of Array Except Self :: prefix[i] * postfix[i] Prefix Postfix

128. Longest Consecutive Sequence :: For each item, while item+1 is in the map continue the count. Map Lookups

20. Valid Parentheses :: put the openers on a stack, when you close pop and make sure they match. LIFO Stack

155. Min Stack :: A Monotonic Stack can be used to keep track of the minimum value in tandem with the normal stack.

150. Evaluate Reverse Polish Notation :: stack.push(pop(B) operation pop(A)) else push int. LIFO Stack

125. Valid Palindrome :: Using Two Pointer Converging make sure each side is equal

167. Two Sum II - Input Array Is Sorted:: Two Pointer Converging - Left moves when sum < target. Right moves when sum > target.

15. 3Sum :: For each item in the array, do a Two Pointer Converging on the remaining content where: Left moves when sum < target. Right moves when sum > target.

11. Container With Most Water :: Given that, you have a rectangle with uneven sides, moving the smaller side will possibly increase the area. Therefore, you can use Two Pointer Converging where Left moves when its smaller, and Right moves when its smaller. Storeing max area on each iteration.

42. Trapping Rain Water :: Prefix Postfix, where each is the max from LTR and RTL. depth(i)=max(LTR[i], RTL[i]) -current[i]. This can be simplified using Two Pointer Converging so that it does not need the arrays.

Undo redo manager :: Using a double linked list, you can O(1) trim the history and insert at the current value.