(Remade) Subsets I | Leetcode 78 | Backtracking

preview_player
Показать описание
Topic: Backtracking

Code:

Leetcode:

*Note* I claim no rights to this question. All rights belong to Leetcode. The company tags in the video title are tagged by Leetcode. If I'm reviewing a solution that was from another Leetcode user or Leetcode itself I will give credit below.

Intro:(0:00)
Input/Output/Approach:(0:10)
Higher Level:(4:44)
Code:(6:57)
Complexities:(8:00)

Hey there! Just wanted to let you know that some of the below links in this video description are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!

Рекомендации по теме
Комментарии
Автор

The first person to enable me to see this problem clearly. You have a gift for speech.

MakingVidsBreh
Автор

There are videos on this topic with 26 minutes duration explaining just the tree diagram without any code. Everyone can explain the tree diagram but connecting the diagram with the code is the reason why we come to watch a video. This guy connected the two in under 10 minutes. 👏👏👏

chiranjeevipippalla
Автор

wow this video helped me so much, seeing it draw on a whiteboard and more in person is so much more helpful then looking at the code myself

tpsspace
Автор

Please please please make more videos! I have watched many Q78 videos, but yours is definitely the best and structured overall! Thank you so much sir!

fantasy
Автор

This is the best way I've seen the Subset problem logic drawn out, conceptualized, and converted into code. You nailed it with this explanation - super helpful!

binetlee
Автор

Specifically calling attention to the recursive "branches" separates this video from similar attempts to explain backtracking. Thank you!

ChadS
Автор

This is the best explanation I came across. Most of the people just eat and spit out the solution.

ragavnitinpande
Автор

I am hardly managing to not spam compliments in capslock here. This explanation was absolutely amazing.

Mexximillion
Автор

By far the best explanation I've seen. The recursive tree helped immensely with understanding the reason for the remove after returning from the stack call.

jelliott
Автор

Ohhh man.. Where you have been this long... 😊🤟 Great explanation 📌

sivakumarg
Автор

Alright the explanation is damn good and you promptly remade this video. Thanks a lot!💯💯

vasachisenjubean
Автор

Best explanation of this problem on youtube. Went through all my usual guys, but they all flopped this question. Earned a sub

sofoboachie
Автор

watched 8+ vids and this is the one that actually made sense thank you

AK
Автор

super clear. thank…i checked out many video non as clear as yours

tarankaranth
Автор

Thanks for the quality explanation of the problem. Much appreciated

josephyang
Автор

beautiful explanation! i was struggling with backtracking and this cleared everything up.

michael
Автор

where do we check for duplicates in this approach ?

rishmithahahaha
Автор

what does List<List<Integer>> means exactly

sahilmehra
Автор

Hey there! Just wanted to let you know that some of the links in this comment are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!

NideeshTerapalli
Автор

I thought collecting from the leaves makes it more intuitive. You seem to be collecting every time control comes to line#3 in your code.

public static void combination1(int[] input, int i, List<List<Integer>> result, List<Integer> path) {
if (i == input.length) {
result.add(new LinkedList<>(path));
return;
}

path.add(input[i]);
combination1(input, i + 1, result, path);
path.remove(path.size() - 1);
combination1(input, i + 1, result, path);

}

shiladityadey