Rerooting is one of the technique I love the most. It's like father helping his children to solve their problem lol. And thanks for problem F, really enjoyed doing it.
indeed a pretty interesting question! the question from cses and codeforces only differ slightly. The leetcode one is actually harder than LC this time :p although not that hard.
@RP409 My approach for this problem was to find a node such that any of it's two child subtree has 1 in it and the node lies in middle of their path. After that we can brute force to get minimum moves.
Wow! what an explanation with drawings.... You are a very good teacher...
This is a good topic very frequent in recent coding tests
Rerooting is one of the technique I love the most. It's like father helping his children to solve their problem lol.
And thanks for problem F, really enjoyed doing it.
Tip:- When it comes to rerooting, go dad mood :p
indeed a pretty interesting question! the question from cses and codeforces only differ slightly.
The leetcode one is actually harder than LC this time :p although not that hard.
@@Acodedaily please upload tutorial of q4 lc asap brother also if you can discuss whether this can be solved ujsing dp on trees would be great help
@RP409 My approach for this problem was to find a node such that any of it's two child subtree has 1 in it and the node lies in middle of their path. After that we can brute force to get minimum moves.
@@aaravarya4406 therre is a better and more intuitive way. I think I would make a video on this
Hey dude, thanks for the video :)
Discord server: discord.gg/H8TeFjvq6z
Tree rerooting problems:
cses: cses.fi/problemset/task/1133
leetcode: leetcode.com/problems/difference-between-maximum-and-minimum-price-sum/description/
codeforces: codeforces.com/contest/1092/problem/F
Thanks man
you are a good teacher!
Just a little doubt , can we consider any node as root node and answer will be same????
nooooooo
okay but whats the answer to the question in the thumbnail?