My LeetCode Path and C++ language learning
- get familiar with algorithms
- start with using java but later start to use c++
- linklist
- how it different from c as have new
- nullptr use
- usually return headNode->next to get rid of the default 0 pointer
- trees
- Dynamic Programming
- state the subproblem to solve
- solving the original problem by subproblems
- recursive formula to computer the subproblem
- 1D array or 2D array both possible
- vector use
- string manipulation
- integer / string change
- double vector (2D array)
- integer
- overflow handle
- INT_MAX, INT_MIN
- module and divide
- palindrome
- binary search
- find mid and update low / high
- try more use <= since = is most time handled seperately in next loop
- try one some base case like 1/2/3 element as input
- rotated sorted array have a part of the array sorted
- divide and conquer
- calculate some thing about this case
- then call max/min of three cases (left, this, right)
- priority queue
- implemented using a heap to get the min/max
- default is max, if want min need
- priority_queue<int, vector, greater> heap;
- std::priority_queue<int, std::vector, std::greater> heap;
- push, pop, top