Hi Rashmi! What I mean here is that the decision made at an arbitrary step called i-1 depends on future decisions to run or not run the punchcard. This sounds counterintuitive — after all, humans cannot make decisions based on a future that hasn’t happened yet! However, dynamic programming is different: the initial decision (base case) occurs at either the start (the first punchcard) or the end (the last punchcard). In this problem, I started making decisions from punchcard n (the last punchcard) and worked backwards from there, which implies that the decision about punchcard n-1 depends on the decision made about punchcard n. This is analogous to my statement that the decisions made for punchcards i through n impact whether the algorithm runs punchcard i-1.

--

--

iOS engineer, writer, and general glossophile. she/her.

Love podcasts or audiobooks? Learn on the go with our new app.

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
Alaina Kafkes

Alaina Kafkes

iOS engineer, writer, and general glossophile. she/her.

More from Medium

10 things I’ve become since knowing Christ

Being Thankful

FRIENDSHIP

3 Ways to Discover Your true self