You need to find the largest value in each row of a binary tree.
1 / \ 3 2 / \ \ 5 3 9
Output: [1, 3, 9]
Implementation: Please check the main.js snippet for the solution. If you have different approach in mind or have any suggestion for this implementation feel free to share in the comment below. Thanks!