3373. Maximize the Number of Target Nodes After Connecting Trees II | Graph | DP on Trees | Greedy

  Рет қаралды 631

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 5
@ARYANMITTAL
@ARYANMITTAL 2 күн бұрын
C++ Code - leetcode.com/problems/maximize-the-number-of-target-nodes-after-connecting-trees-ii/submissions/1467126572/ Please do share with your friends or social media, it will be super super helpful 🥺
@rrrhitk
@rrrhitk Күн бұрын
Really liked the approach
@vision-into-future
@vision-into-future 2 күн бұрын
Liked your approach which is definitely more intuitive, here's my approach which i felt a bit simpler. - use BFS similar to Q3, but this time instead of pre-computing count of neighboring nodes
@Jazzimus
@Jazzimus 2 күн бұрын
there was one more key observation to this problem which made it trivial: if for some node "node" its even count and odd count are (x, y); then for its neighbours the even and odd count will be (y, x). They just get inverted. We then just have to find maximum such odd from Tree2 and add that to an even[i] from tree1 to get the answer (for some i)
@asmitshukla4649
@asmitshukla4649 Күн бұрын
made the logic and explanation TOO MUCH COMPLICATED, cant understand anything after a point
3371. Identify the Largest Outlier in an Array | Hash Table | Math
12:33
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 63 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 18 МЛН
Introduction to Graph Theory: A Computer Science Perspective
16:26
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 159 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 447 М.
Variational Autoencoders
15:05
Arxiv Insights
Рет қаралды 516 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 63 МЛН