- REMEMBER READ THE PROBLEM STATEMENT AND DON'T SOLVE A DIFFERENT PROBLEM
- REMEMBER LOOK FOR RANDOM UNINTUITIVE DETAILS IN THE PROBLEM
- read the bounds for edge cases
- function calls are not free
- unordered naive is faster than lb vector standard
Steps:
- Clarify Questions
- High-level solution
- write out steps of your solution / pseudocode
- put some input and check if it works
- put input in here
Framework for solving DP problems:
- Define the objective function
- Identify base cases
- Write down recurrence relation ( or transiotion function) for the optimized objective function
- What is the order of execution ? (top to buttom or buttom to top)
- Where to look for the answer
No comments:
Post a Comment