https://practice.geeksforgeeks.org/problems/transform-to-sum-tree/1