I didn't record any information about the problems I've done. It would be ideal to classify problems and note how they were solved.
- Two Sum: Check Hashmap for complement
- Remove Duplicates: Swap placeholder for greater value
- Plan before execution
- Remove Element: Swap placeholder for non-target
- More or less, both remove problems just involve keeping track of two indices
- Plus One: Iterate backwards, unshift, and either logic or mod/divide.
- Merge: Using an array to hold values in sorted order until they're ready to be inserted
- A better solution is to iterate backwards, placing the largest values in nums1.
- Pascal's Triangle: Just code the generation logic.
- Pascal's Triangle II: N/A
- Best Time to Buy and Sell Stock: Compare current lowest price with future prices until new lowest price is found, keeping track of highest profit.
- Roman to Integer: Utilize a hashmap, and add or subtract value depending on next symbol
- Add Two Numbers: Div, mod, and carries
- The cleanup for this one is really nice since no value can be changed to 0
- Merge Two Sorted Lists: Linked List understanding/knowledge.
- Search Insert: Just binary search, but return low if not found
- Sorted Array to BST: Recursive solution that ensures every tree is a BST
- Single Number: Xor
- Climbing Stairs: Think of a decision tree + cache or think about fibo (how the previous two results create the next)