_abstract_'s blog

By _abstract_, history, 2 years ago,

i have tried a lot but not able to construct the tree. i am not able to understand the code please can any one make me understand in easy language.

• +2

 » 2 years ago, # |   0 The solution is into $3$ parts: Making straight chain, so $1$ node each at a height of $0,1,\ldots,p$. Adding $n-p-2$ nodes at height $1$. Adding the remaining $1$ node at height which satisfy the score constraint. Do read the tester's code instead, my code was an alternate lengthy solution.
•  » » 2 years ago, # ^ |   0 ya but for testcase 5 6 we can get maximum p=3 ans no. of nodes till now is=4; we are left with one node and remaining length we need is 0; but where to add one extra node.