PRIMEDST - Editorial

okay, take a look at the tree in the pic above. if you remove node 7, what is the complexity of merging the tree? Put the node 7 as a child to node 5, now how much time will it take?

1 Like

Used the same approach in the contest… Got a TLE! The NOP idea did not strike! Nice one :slight_smile:

3 Likes

okay, I think I get it. Thanks :slight_smile:

My O(N^2) algo failed!! Someone is lying!

2 Likes

You can try submit my code and check :slight_smile:

1 Like

even I used the same concept but got WA, missed some case somewhere I think. Onto it now. Nice exp btw :slight_smile: