3068. Find the Maximum Sum of Node Values | Bit Manipulation | Tree | Graphs

  Рет қаралды 6,185

Aryan Mittal

Aryan Mittal

3 ай бұрын

In this video, I'll talk about how to solve Leetcode 3068. Find the Maximum Sum of Node Values | Bit Manipulation | Tree | Graphs
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
100Days 100k Placements: • 100 Days 100K Placement
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 38
@storyime
@storyime 3 ай бұрын
1 comment ❤
@ARYANMITTAL
@ARYANMITTAL 3 ай бұрын
Yeahh man 🗿🫂
@a.saikumar9906
@a.saikumar9906 28 күн бұрын
Bro Just I felt love with ur teaching u know. After stiver I felt like u are the most adorable teacher I have ever seen .
@vinitkeshri9938
@vinitkeshri9938 28 күн бұрын
This was today's daily. Thanks !!
@Antinormanisto
@Antinormanisto 28 күн бұрын
Thanks, but I have a problem. I understand all of this except finding baliKaBrakra
@IK-xk7ex
@IK-xk7ex 3 ай бұрын
unbelievable! how I can come up with the solution by myself :/ ?
@princenagar1686
@princenagar1686 28 күн бұрын
This was totally a Math question for Olympiads, this question can never come in interviews. That's what i found, even thought i understand the code and you explanation but I am not going to submit it on Leetcode because i never going to get the intuition of this solution by my own. But thanks for explanation.
@PramodKumar-bu2uf
@PramodKumar-bu2uf 3 ай бұрын
Amazing explaination , very amazing logic , ❤❤
@asmitdixit5776
@asmitdixit5776 28 күн бұрын
wonderfull approach and explaination ❤
@pushpamudalkar6756
@pushpamudalkar6756 26 күн бұрын
best explanation for this question.
@Munchen888
@Munchen888 28 күн бұрын
Thank you for good explanation and good mood ))
@SweetRainbow-zg4wv
@SweetRainbow-zg4wv 3 ай бұрын
Very good explanation sir🎉
@PriyanshuSinha-vd7yo
@PriyanshuSinha-vd7yo 28 күн бұрын
Great solution aryan!
@vanshmotwani2610
@vanshmotwani2610 3 ай бұрын
Great explanation bro! Keep it up :)
@b3njamMMVII
@b3njamMMVII 28 күн бұрын
very good explanation, thank you :)
@SD-vk3ko
@SD-vk3ko 28 күн бұрын
Awesome Explanation Aryan
@ARYANMITTAL
@ARYANMITTAL 28 күн бұрын
Glad it helped 🫂❤️
@ManishKumar-hh6bf
@ManishKumar-hh6bf 28 күн бұрын
Hi great content .. have wached a lot of your videos ... great help... just a little feedback .. videos are really long I mean explaination is bit slower ..even 1.5X seems slow ... can improve on less repetition
@abhishekgoudah6015
@abhishekgoudah6015 3 ай бұрын
Subscribed seeing Bali Ka Bakra usage
@Anonymous____________A721
@Anonymous____________A721 2 ай бұрын
Oh my god Edges vector is not required at all💀💀💀💀💀💀💀 Tree->normal array
@namandubey8348
@namandubey8348 28 күн бұрын
Nice video man very good video
@hxgaming8886
@hxgaming8886 3 ай бұрын
awesome bro
@kavangondalia688
@kavangondalia688 28 күн бұрын
How can you be sure that the sacrifice made is good? I meant that what if the odd one (the one for which we're finding a pair) which increases the result by "x" is less than the baliKaBakra (value by which the result decreases)? In that case, it would be good if we don't increase that odd one.
@princenagar1686
@princenagar1686 28 күн бұрын
So edges has no role to play in this question, that was given redundantly to us.
@dewanandkumar8589
@dewanandkumar8589 28 күн бұрын
Understood
@a.saikumar9906
@a.saikumar9906 28 күн бұрын
@kavangondalia688 already rasised this question. now are contributing nodes are odd and how can u judge that balikabakra leaving is always a good one. There is the possibility that balikabakra lets say it has node value 9 and it increases to 15 and if we take a node which is original 7 and for some k it decreases to 5 in this case simply leaving the node 9 is not good right
@giridharanpasupathi
@giridharanpasupathi 3 ай бұрын
Bro contest upsolving pls ❤
@ARYANMITTAL
@ARYANMITTAL 3 ай бұрын
All problems coming sir ❤️❤️🫡
@_ShreyanshAgrawal
@_ShreyanshAgrawal 3 ай бұрын
What is your rank ?? In today contest ??
@it-041-satheeshkumar.k7
@it-041-satheeshkumar.k7 28 күн бұрын
what is the use of the edges in the problem? you haven't used it anywhere.
@nagasrisaichaitanyakolluri8173
@nagasrisaichaitanyakolluri8173 28 күн бұрын
🎉🎉
@ankitsahu2305
@ankitsahu2305 3 ай бұрын
class Solution { public: long long solveRec(vector &nums, int k, vector &edges, int idx, vector &dp) { int n = edges.size(); if (idx >= n) { long long temp = 0; for (int x : nums) temp += (long long)x; return temp; } if (dp[idx] != -1) return dp[idx]; int iZero = nums[edges[idx][0]]; int iOne = nums[edges[idx][1]]; nums[edges[idx][0]] ^= k; nums[edges[idx][1]] ^= k; long long l = solveRec(nums, k, edges, idx + 1, dp); nums[edges[idx][0]] = iZero; nums[edges[idx][1]] = iOne; long long r = solveRec(nums, k, edges, idx + 1, dp); dp[idx] = max(l, r); return dp[idx]; } long long maximumValueSum(vector &nums, int k, vector &edges) { int n = edges.size(); vector dp(n, -1); return solveRec(nums, k, edges, 0, dp); } }; Bro why this solution does not work? It is giving correct answer without optimisation, but as i optimise, it is giving wrong answer?
@vishalkhurana6927
@vishalkhurana6927 27 күн бұрын
you're changing nums also and not considering that nums is also changed same i can be visited with different values present in nums so you're limiting all possible solution(recursive calls)
@GeetainSaar
@GeetainSaar 27 күн бұрын
Your age?
@asmitshukla4649
@asmitshukla4649 28 күн бұрын
ghanta samajh ni aya kuch
@rockerzgaming710
@rockerzgaming710 28 күн бұрын
bhai mehnat to kar raha h lekin samjh nhi aa rahe tumhare samjhae soln
@025-harshbindal7
@025-harshbindal7 28 күн бұрын
bhai yaarr tu acting bhut karta hai😮‍💨
Каха инструкция по шашлыку
01:00
К-Media
Рет қаралды 8 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:19
CRAZY GREAPA
Рет қаралды 8 МЛН
ПООСТЕРЕГИСЬ🙊🙊🙊
00:39
Chapitosiki
Рет қаралды 68 МЛН
АСМР Я ПРОВАЛИЛ ЕГЭ
17:26
Gazetu$ ASMR
Рет қаралды 4,7 М.
Find the Maximum Sum of Node Values - Leetcode 3068 - Python
17:50
Most Common Concepts for Coding Interviews
6:08
NeetCode
Рет қаралды 276 М.
3068. Find the Maximum Sum of Node Values - Day 20/31 Leetcode May Challenge
9:14
Programming Live with Larry
Рет қаралды 907
Someone improved my code by 40,832,277,770%
28:47
Stand-up Maths
Рет қаралды 2,4 МЛН
Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
1:47:13
Lex Fridman
Рет қаралды 1 МЛН
Каха инструкция по шашлыку
01:00
К-Media
Рет қаралды 8 МЛН