Hey Red Coders,
Recently, I have been trying to solve all the problems in the CSES tree section, but even after trying many things, I have failed to solve the last two problems. After searching for solutions, I learned that they can be solved using Centroid Decomposition.
I read some blogs and watched videos on YouTube, but I still can’t grasp the logic. Although I could pretend to understand it and simply code to complete the CSES section, I genuinely want to learn and understand why and how it works so that I will be able to solve questions based on it in the future.
I would greatly appreciate it if anyone is willing to explain it to me and help build my intuition around it.
Resources I have tried( although they are really great, but due to my limited knowledge I am not able to grasp the logic):