Combination Sum - Leetcode 39 - Recursive Backtracking (Python)

  Рет қаралды 9,240

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 14
@GregHogg
@GregHogg 5 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@chisomedoka5651
@chisomedoka5651 7 ай бұрын
why is backtracking so hard!!!!!!! I feel dumb, thanks for you explanation. Currently watching for the fifth time
@anna-plink
@anna-plink 4 ай бұрын
You're not alone!!
@Johnson_Amah
@Johnson_Amah 2 ай бұрын
You are definitely not alone
@jithendragunuru
@jithendragunuru 2 ай бұрын
+1
@vinaylasetti4665
@vinaylasetti4665 10 күн бұрын
Backtracking is a mechanism formed by don't pick a choice and pick a choice approach to arrive at a target solution combination. As per my understanding, we can use backtracking technique whenever we have to deal with combinations. So If you ask why Backtracking? because without backtracking we would endup in duplicate combination of solutions. I hope this gives some light! Thanks
@ohmyoni
@ohmyoni 8 ай бұрын
I really like these recursive backtracking problems, you explain them well.
@GregHogg
@GregHogg 8 ай бұрын
Oh I'm really glad to hear that. Such a tricky topic, I'm glad I did okay 😊
@saleheen12
@saleheen12 2 ай бұрын
The graph showed in the video hurt my brain but when I saw the code. I realized, it's almost the same code as "Subsets" problem.
@jst8922
@jst8922 8 ай бұрын
What tool you use for digital whiteboard (3:43) ?
@mohammadrafi895
@mohammadrafi895 5 ай бұрын
You wanna teach too?
@BluAngy
@BluAngy 4 ай бұрын
That is Miro
@JoeTan-nq4fq
@JoeTan-nq4fq 15 күн бұрын
Using a for..loop seems easier def dfs(index: int, remainder: int, state: list) -> None: # Base Case if remainder < 0: return if remainder == 0: return result.append(state[:]) # Backtrack when the remainder is less than 0 for i in range(index, n): if (x := remainder - candidates[i]) >= 0: dfs(i, x, state + [candidates[i]]) else: return [2,3,5], 8 index = 0 1 2 canddidates[i] = 2,3,5 3,5 5 ________[ ]_________ / | \ i=0 __[2]__ [3] [5] / \ / \ i=0 [2,2] [2,3] [3,3] [3,5] / \ | i=0 [2,2,2] [2,2,3] [2,3,3] | i=0 [2,2,2,2]
@alichopping2703
@alichopping2703 3 ай бұрын
These videos are great, can you do one for Combination Sum II?
Combination Sum - Backtracking - Leetcode 39 - Python
15:10
NeetCode
Рет қаралды 340 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Recursive Backtracking - DSA Course in Python Lecture 14
12:58
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 725 М.
Prefix Sum in 4 minutes | LeetCode Pattern
4:13
AlgoMasterIO
Рет қаралды 16 М.
Permutations - Leetcode 46 - Recursive Backtracking (Python)
9:42
3Sum - Leetcode 15 - 2 Pointers (Python)
9:42
Greg Hogg
Рет қаралды 14 М.
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 305 М.
Math News: The Fish Bone Conjecture has been deboned!!
23:06
Dr. Trefor Bazett
Рет қаралды 215 М.
Combinations - Leetcode 77 - Python
10:38
NeetCode
Рет қаралды 73 М.
Terence Tao at IMO 2024: AI and Mathematics
57:24
AIMO Prize
Рет қаралды 708 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН