Wowza. DP is hard. But I did realize that if I ever got in an interview. I would start basic, draw pictures, find shortcuts, and eventually logic my way through to the answer. This process is very important to follow.
- I realized how hard DP problems are, they are recursive problems on steroids. Anyways I find the brute force solution for all of them, but can't find the DP. I completed one medium pretty easily.
- I got stumped on the second one, but I was pretty close to the solution. I thought the DP solution is always incredibly efficient so I was hesitant on my answer, but DP just helps optimize so honestly the solution often is O(n^2)
- I just had to iterate backwards, and I would have gotten it.
- The last DP problem, I tried reasoning my way through for a half hour, but didn't get close. It was brute force again. It was 0/1 napsack. I'm gonna try again next time I do DP problems.
No comments:
Post a Comment