Comments

If you observe carefully, the code actually does update all the nodes in the path which is what you want to do.

+1

Can someone please explain Div2 E (Div1 C) explanation? It says choose the minimum alive element. But following this in test case 3 (1 2 3 4 5), we get a wrong answer = 3.