LeetCode | 494 Target Sum | Python 3 | Recursion to Dynamic Programming | Explanation

  Рет қаралды 3,462

ygongcode

ygongcode

Күн бұрын

Пікірлер: 7
@Claydelas
@Claydelas 3 жыл бұрын
The intuition for constructing and populating the table based on the recursive brute-force solution helped me greatly with solving other dynamic programming problems. Huge thanks buddy!
@jd3287
@jd3287 8 ай бұрын
you should fill out the table
@arnabpersonal6729
@arnabpersonal6729 3 жыл бұрын
pretty good but why do we need a nth row
@ygongcode
@ygongcode 3 жыл бұрын
Because it is the terminal case. If you look at the recursive representation of this problem, the nth row is your recursion base case, aka root of the recursive tree and there are N levels of branches extending from the root. If you map it to the DP approach, one dimension of the table (# of rows, in this case) is effectively the height of your recursive tree, which is N+1.
@forrestjaustin4244
@forrestjaustin4244 3 жыл бұрын
using nums = [1,1,1] is not a good clear example.. you should have used different numbers in the array
@ygongcode
@ygongcode 3 жыл бұрын
Yeah fair point. Noted :)
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 197 М.
Target Sum - Dynamic Programming - Leetcode 494 - Python
12:10
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 2,8 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 133 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
494. Target Sum | Leetcode Medium
14:03
JOY of LIFE
Рет қаралды 2,3 М.
Data Analysis with Python for Excel Users - Full Course
3:57:46
freeCodeCamp.org
Рет қаралды 3,2 МЛН
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
Solving distributed systems challenges in Rust
3:15:52
Jon Gjengset
Рет қаралды 278 М.
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
The Traveling Salesman Problem: When Good Enough Beats Perfect
30:27
Dynamic Programming 1D - Full Course - Python
2:59:19
NeetCode
Рет қаралды 259 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 2,8 МЛН