title: Knapsack Problem - Recursive solution explanation
body: <p>I’m having trouble understanding how and why this naive recursive solution works. If I was given this problem for the first time, I’d think of doing an exhaustive search (iteratively) with all possible combinations, recording and returning the maximum value at the end. Can someone please explain this solution?</p>
  
  <p><a href="https://i.stack.imgur.com/MAMFk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MAMFk.jpg" alt="code from CSDojo"></a></p>
  
  <p>Code from CSDojo</p>