Dissecting Dynamic Programming — Target Sum I

Problem Statement

Problem Analysis:

Problem Breakdown Tree:

Figure #1 — break down of targetSum to base cases

canSum(targetSum, integers):

Figure #2 —stops the exploration when one combination is found
Figure #3 — top down implementation of canSum

countSum(targetSum, integers):

Figure #4 — countSum breakdown tree
Figure #5 — top down implementation of countSum

howSum(targetSum, integers):

Figure #6 — top down implementation of howSum

bestSum(targetSum, integers):

Figure #7 — top down implementation of bestSum

Summary

Resources:

--

--

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