Diagonal Sum Binary Tree Problem
Published in
Nov 11, 2023
Given the root of a binary tree, return the sum of all nodes for each diagonal having negative slope `\`. Assume that the left and right child of a node makes a 45–degree angle with the parent.
Input:
Output: [10, 15, 11]
Explanation: The binary tree has three diagonals — [1, 3, 6], [2, 5, 8], and [4, 7]. The sum of diagonals is 10, 15, and 11 respectively.
Practice link: https://www.techiedelight.com/?problem=DiagonalSumBinaryTree