2025/04/04 4

[Leetcode] 515. Find Largest Value in Each Tree Row

문제Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). Example 1:Input: root = [1,3,2,5,3,null,9] Output: [1,3,9] Example 2:Input: root = [1,2,3] Output: [1,3]  Constraints:The number of nodes in the tree will be in the range [0, 104].-231 풀이 bfs를 사용하는 문제이다.각 row를 bfs 로 찾고, for loop안의 각 element의 최댓값을 찾아준다.코드/** * Definition for a binary tree ..

Leetcode 2025.04.04