r/programming • u/svpino • May 08 '15
Five programming problems every Software Engineer should be able to solve in less than 1 hour
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k
Upvotes
2
u/comp-sci-fi May 09 '15
Hi I've never managed to get clear on the definition of "dynamic programming", can you elaborate to help me, please? (below is what I think).
(Apart from your sib comment) I think it's a way of recording intermediate results, and when the same one appears again, effectively merge them, instead of recalculating.
But here, I think the only dynamic programming we can do is only a slight implementation improvement on raw brute force, and reusing earlier calculations. It falls naturally out of a DFS: given first choice (12 or 1+2 or 1-2) you calculate that, and use it as the starting point for the next choice. Do the same thing recursively.