Recently finished the first term of my first year CompSci course and got stung when the lecture introduced the recursion concept by jumping in straight to the rodCutting problem. Glad to hear DP is a hard concept to grasp as I still struggle to work that one out. A huge thanks for making this content available to us all. No all heroes wear capes! Cheers
man the way and the speed you teach at just perfectly fits in with the way, I like someone to teach me and at the perfect speed, hoping to see more of your videos soon man.
Thanks so much, this is awesome! I would really be super grateful if you could do a video explaining Accounts Merge problem because there is not a single one good explanation on youtube and you're the best at this! Also consider opening a Patreon or something where we can give you at least some amount of money if someone wants to! :)
thank you so much!!!!! but happy to provide for free, i don't want your guys' money :) I'll consider throwing a video up on it -- especially knowing nobody else has covered it well. In the meantime, I'll post my code below. I wrote it a while back, unaudited, so proceed with caution: class Solution(object): def accountsMerge(self, accounts): emailToName = {} emails = {} for acc in accounts: name = acc[0] for email in acc[1:]: if acc[1] not in emails: emails[acc[1]] = set() emails[acc[1]].add(email) if email not in emails: emails[email] = set() emails[email].add(acc[1]) emailToName[email] = name seen = set() ans = [] for email in emails: if email not in seen: seen.add(email) stack = [email] component = [] while stack: node = stack.pop() component.append(node) for neighbour in emails[node]: if neighbour not in seen: seen.add(neighbour) stack.append(neighbour) ans.append([emailToName[email]] + sorted(component)) return ans
What do I do if I can't even understand how to implement the recursive solution first? I don't have any idea how you would start to solve the robot problem. All I ever get for an explanation of recursion is the basics like factorial or fibonacci sequence, but I do not know your logic for how to solve this unique paths problem, or even how you derived it.
Hey Amor, first thought is more practice required on recursion problems. This one is ranked Medium -- I would suggest going through all Easy problems you can find with recursion. Building from basics is best. (For the record, when I started on Leetcode I couldn't even solve 2Sum, so there is hope for all of us if enough work is put in). Beyond that, productive struggle to a problem definitely caps out; there is a point at which you hit diminishing returns. There've been many problems (including a large % of the ones I've put up on my channel) where I had to struggle and then look at solution(s) to either complete or optimize my answer. Part of the learning process.
Eyooo! Shifted my focus into other endeavours but i do still plan on jumping back into this, hopefully in not too long. Really have a lot of fun making these!
Just remove the ANY word from the title. Because this is all the theory etc and even the intuition is discussed everywhere, books, videos etc. But all that still does not help when trying to solve a difficult problem. So I was expecting that you will also introduce the intuition both for recursion and DP with more complex problems so that practice and thought process will help solve ANY problem. But you just discussed one problem and probably the most easiest one and call the video title as ANY. I can guarantee that just by watching this video even you will not be able to the next difficult problem where DP will "improve" the recursion. Ask yourself.
Dude, you're the best. Articulate and logical. Can't ask for a better explanation.
really appreciate it, thank you :)
Hey Aleks! Your videos are awesome. Can you please make a video on a detailed explanation of recursion and backtracking
Recently finished the first term of my first year CompSci course and got stung when the lecture introduced the recursion concept by jumping in straight to the rodCutting problem. Glad to hear DP is a hard concept to grasp as I still struggle to work that one out.
A huge thanks for making this content available to us all. No all heroes wear capes! Cheers
So happy to hear! Really happy that I could help :)
what a great human being. You deserves more subscribers
man the way and the speed you teach at just perfectly fits in with the way, I like someone to teach me and at the perfect speed, hoping to see more of your videos soon man.
Appreciate it buddy glad it resonated!
@@babybear-hq9yd please come back🙏🏼 you’re the best at explanations
There are dozens of video on youtube but I learn best from you :)
Humbled as always :) Thank you!!!
Hey Aleks! Where have you been man its been a year since your last upload.
Awesome. I really like your videos. Thanks!
So glad you enjoy them :D
Great video, extremely informative
Thank you Emma, what a thoughtful comment. I appreciate your ongoing support over the years.
Thanks so much, this is awesome!
I would really be super grateful if you could do a video explaining Accounts Merge problem because there is not a single one good explanation on youtube and you're the best at this! Also consider opening a Patreon or something where we can give you at least some amount of money if someone wants to! :)
thank you so much!!!!! but happy to provide for free, i don't want your guys' money :) I'll consider throwing a video up on it -- especially knowing nobody else has covered it well. In the meantime, I'll post my code below. I wrote it a while back, unaudited, so proceed with caution:
class Solution(object):
def accountsMerge(self, accounts):
emailToName = {}
emails = {}
for acc in accounts:
name = acc[0]
for email in acc[1:]:
if acc[1] not in emails:
emails[acc[1]] = set()
emails[acc[1]].add(email)
if email not in emails:
emails[email] = set()
emails[email].add(acc[1])
emailToName[email] = name
seen = set()
ans = []
for email in emails:
if email not in seen:
seen.add(email)
stack = [email]
component = []
while stack:
node = stack.pop()
component.append(node)
for neighbour in emails[node]:
if neighbour not in seen:
seen.add(neighbour)
stack.append(neighbour)
ans.append([emailToName[email]] + sorted(component))
return ans
please keep updating
It's great. Your idea is more understandable and helpful than leetcode card for me. I'm lucky today to meet your video. Thank you so much.
thank you Kaye!! :)
What do I do if I can't even understand how to implement the recursive solution first? I don't have any idea how you would start to solve the robot problem. All I ever get for an explanation of recursion is the basics like factorial or fibonacci sequence, but I do not know your logic for how to solve this unique paths problem, or even how you derived it.
Hey Amor, first thought is more practice required on recursion problems. This one is ranked Medium -- I would suggest going through all Easy problems you can find with recursion. Building from basics is best. (For the record, when I started on Leetcode I couldn't even solve 2Sum, so there is hope for all of us if enough work is put in). Beyond that, productive struggle to a problem definitely caps out; there is a point at which you hit diminishing returns. There've been many problems (including a large % of the ones I've put up on my channel) where I had to struggle and then look at solution(s) to either complete or optimize my answer. Part of the learning process.
If people looked like what their names were, you'd be
"bro", because you look like a true bro, bro.
hahaha, thanks bro!!
Can you tackle 1335. Minimum Difficulty of a Job Schedule or 1235. Maximum Profit in Job Scheduling? Having a hard time wrapping my head around the dp
Hey Vince, I’ve had this one requested a lot recently. I’ll try to get to it and see if I can slap something meaningful together for you guys
Thanks for the effort
hope it helped :)
Awesome video ,why are you not posting any videos for past few weeks 🤔
got tied up in some personal things :) i'll jump back on it soon
@@babybear-hq9yd I just subscribed to your channel after watching some explanations, hope to see new videos soon :) thanks for you work!
@@darioarielgonzalezleegstra1741 ty ty! weclome to the club :)
goated video
watchu up to dawg? been a while
Eyooo! Shifted my focus into other endeavours but i do still plan on jumping back into this, hopefully in not too long. Really have a lot of fun making these!
Just remove the ANY word from the title. Because this is all the theory etc and even the intuition is discussed everywhere, books, videos etc. But all that still does not help when trying to solve a difficult problem. So I was expecting that you will also introduce the intuition both for recursion and DP with more complex problems so that practice and thought process will help solve ANY problem. But you just discussed one problem and probably the most easiest one and call the video title as ANY. I can guarantee that just by watching this video even you will not be able to the next difficult problem where DP will "improve" the recursion. Ask yourself.