Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
I have to say, jumping straight to recursion and not spending time to step throu...

Learner

Jan 9, 2022

I have to say, jumping straight to recursion and not spending time to step through it/explain it is quite discouraging for beginners. To make matters more confusing, no differentiation between brute forcing via 4C4 + 4C3 + 4C2 + 4C1 + 4C0 = 16 as you have in the example, versus 4! = 24 and trying those combinations.

0

0

Comments
Comments
J
JOD Developer3 years ago

the reason they are all filled with one at row zero is because in the beginning you've got only one item and capacity/profit of that object is 1 thats why the all have 1. As u iterate and get more items then u have to make various appropriate decisions.

On this page

Introduction

Problem Statement

Basic Solution

Code

Top-down Dynamic Programming with Memoization

Code

Bottom-up Dynamic Programming

Code

How to find the selected items?

Challenge

Solution code