Sum of nodes on the longest path from root to leaf node
Given a binary tree containing n nodes. The task is to find the sum of all nodes on the longest path from root to leaf node. If two or more paths compete for the longest path, then the path having the maximum sum of nodes is considered.Examples:Â Input: root[] = [4, 2, 5, 1, 3]Output: 13Explanation: