Comments

This not a discussion group, this a group where they will give out solutions for payment.

Proof: https://pasteboard.co/Fwgs8q1oFHsS.bmp

Much appreciated!

What helps me solve questions like B is going through the testcases. We have an operation and we need to figure out when should we use that operation.

One question I got while going through testcases was: Suppose you have 4 1's: 1 1 1 1, should I leave it as is, as it is balanced or should I increase two of 1's to 2's: 1 1 2 2?

The following sample testcase made me realize it is always best to increase whenever possible as the incremented nos. might help in the future.

8

1 1 1 1 1 1 1 4

I have personally learned all these topics from the Competitive Programmer's Handbook and parallelly solved the questions on the cses problemset. I would recommend these for you as well.

On AAA_TripleAI hit 1000 rating today!, 16 months ago
0

Congratulations and all the very best!

+2

Removing the highest degree node greedily won't always work. Suppose:

Tree: 1-3-2-4-5.

Here nodes 2,3 & 4 have degree 2. But here we have to remove node 3 & 4 to get the maximum.