Re:Dynamic Programming for Technical Interviews
by deepGem on Friday March 15, 2019 @02:30AM
(#19397072)
Absolutely, but I attribute the ability to decompose a problem into overlapping subproblems as an understanding of recursion, so I had implicitly assumed such an understanding.
Re:Dynamic Programming for Technical Interviews
by baobabKoodaa on Friday March 15, 2019 @09:26AM
(#19399461)
Try solving some difficult DP problems on CodeForces. You will find that an "understanding of recursion" is not enough to solve them.
Re:Dynamic Programming for Technical Interviews
by eru on Friday March 15, 2019 @10:05AM
(#19399774)
No, no, it is an understanding of how to recurse just right. Not an understanding of the concept of recursion in general.
Basically, recursion plus memoization is almost the same in terms of power and approach as dynamic programming.
Re:Dynamic Programming for Technical Interviews
by baobabKoodaa on Friday March 15, 2019 @12:51PM
(#19401518)
No, it's not, and if you actually tried to solve one of the harder DP problems, this would become very obvious to you.
Here's one for you: https://codeforces.com/problemset/problem/1097/G
It's a dp problem, and you understand how to recurse just right, and you understand memoization, so you'll be able to solve it, right? Link your solution when you reply please.
Re:Dynamic Programming for Technical Interviews
by baobabKoodaa on Wednesday March 20, 2019 @11:59AM
(#19443487)
...That's what I thought.
Take string edit distance for example: the key to the dynamic programming problem is seeing how the exponential blow up of possibilities actually has a rich overlapping structure that you can cache in a table. If you didn't know string edit distance was amenable to dynamic programming, you might not realize it at all even if you are constantly thinking about caching results. Once you see the structure, the algorithm becomes relatively straightforward.