1161. Maximum Level Sum of a Binary Tree
Maximum Level Sum of a Binary Tree - LeetCode 이진 트리의 루트 노드가 주어질 때, 각 레벨에 있는 노드 값의 합이 최대인 레벨 x를 반환합니다. Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level x such that the sum of all the values of nodes at level x is maximal. Example 1: Input: root = [1,7,0,7,-8,null,null] Output: 2 Explanation: Level 1 sum = 1. Level 2 ..
LeetCode
2023. 10. 29. 17:53