Dynamic Programming: Memoization (The Top-Down Approach)

boxes in red are being solved multiple times. not efficient
our tree has shrank significantly!
@memo[2] = 1
as we can see all the boxes in red at this point are stored in our array!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store