Minimize Tree Height via Subtree Reattachment

Company: spotnana_7oct

Difficulty: medium