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

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

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 37
@storyime
@storyime 6 ай бұрын
1 comment ❤
@ARYANMITTAL
@ARYANMITTAL 6 ай бұрын
Yeahh man 🗿🫂
@a.saikumar9906
@a.saikumar9906 3 ай бұрын
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 4 ай бұрын
This was today's daily. Thanks !!
@pushpamudalkar6756
@pushpamudalkar6756 3 ай бұрын
best explanation for this question.
@Antinormanisto
@Antinormanisto 4 ай бұрын
Thanks, but I have a problem. I understand all of this except finding baliKaBrakra
@IK-xk7ex
@IK-xk7ex 6 ай бұрын
unbelievable! how I can come up with the solution by myself :/ ?
@PramodKumar-bu2uf
@PramodKumar-bu2uf 6 ай бұрын
Amazing explaination , very amazing logic , ❤❤
@asmitdixit5776
@asmitdixit5776 3 ай бұрын
wonderfull approach and explaination ❤
@princenagar1686
@princenagar1686 3 ай бұрын
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.
@ManishKumar-hh6bf
@ManishKumar-hh6bf 3 ай бұрын
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
@Munchen888
@Munchen888 3 ай бұрын
Thank you for good explanation and good mood ))
@Anonymous____________A721
@Anonymous____________A721 5 ай бұрын
Oh my god Edges vector is not required at all💀💀💀💀💀💀💀 Tree->normal array
@b3njamMMVII
@b3njamMMVII 4 ай бұрын
very good explanation, thank you :)
@SweetRainbow-zg4wv
@SweetRainbow-zg4wv 6 ай бұрын
Very good explanation sir🎉
@kavangondalia688
@kavangondalia688 4 ай бұрын
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.
@PriyanshuSinha-vd7yo
@PriyanshuSinha-vd7yo 4 ай бұрын
Great solution aryan!
@SD-vk3ko
@SD-vk3ko 4 ай бұрын
Awesome Explanation Aryan
@ARYANMITTAL
@ARYANMITTAL 4 ай бұрын
Glad it helped 🫂❤️
@namandubey8348
@namandubey8348 4 ай бұрын
Nice video man very good video
@dewanandkumar8589
@dewanandkumar8589 3 ай бұрын
Understood
@a.saikumar9906
@a.saikumar9906 3 ай бұрын
@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
@princenagar1686
@princenagar1686 3 ай бұрын
So edges has no role to play in this question, that was given redundantly to us.
@vanshmotwani2610
@vanshmotwani2610 6 ай бұрын
Great explanation bro! Keep it up :)
@abhishekgoudah6015
@abhishekgoudah6015 6 ай бұрын
Subscribed seeing Bali Ka Bakra usage
@hxgaming8886
@hxgaming8886 6 ай бұрын
awesome bro
@it-041-satheeshkumar.k7
@it-041-satheeshkumar.k7 3 ай бұрын
what is the use of the edges in the problem? you haven't used it anywhere.
@ankitsahu2305
@ankitsahu2305 6 ай бұрын
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?
@selfgrowthsigma
@selfgrowthsigma 3 ай бұрын
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)
@nagasrisaichaitanyakolluri8173
@nagasrisaichaitanyakolluri8173 4 ай бұрын
🎉🎉
@_ShreyanshAgrawal
@_ShreyanshAgrawal 6 ай бұрын
What is your rank ?? In today contest ??
@giridharanpasupathi
@giridharanpasupathi 6 ай бұрын
Bro contest upsolving pls ❤
@ARYANMITTAL
@ARYANMITTAL 6 ай бұрын
All problems coming sir ❤️❤️🫡
@asmitshukla4649
@asmitshukla4649 3 ай бұрын
ghanta samajh ni aya kuch
@025-harshbindal7
@025-harshbindal7 4 ай бұрын
bhai yaarr tu acting bhut karta hai😮‍💨
@rockerzgaming710
@rockerzgaming710 4 ай бұрын
bhai mehnat to kar raha h lekin samjh nhi aa rahe tumhare samjhae soln
Find the Maximum Sum of Node Values - Leetcode 3068 - Python
17:50
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
МАИНКРАФТ В РЕАЛЬНОЙ ЖИЗНИ!🌍
00:31
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 34 МЛН
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 326 М.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 296 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 140 М.
Google Coding Interview With A Competitive Programmer
54:17
Clément Mihailescu
Рет қаралды 2,5 МЛН
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 400 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН