O36
Binary Tree Right Side View
Problem Statement & Objective
Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
Function Signature (Python)
binary_tree_right_side_view(root: list) -> list[int]Input & Output Contract
Output Rule:Her seviyenin en sağındaki düğüm değerlerinin listesi.
System Constraints
0 <= agac.length <= 2000
-100 <= agac[i] <= 100Example Execution Walkthrough
agac = [1, 2, 3, None, 5, None, 4]
Seviye 0: 1
Seviye 1: 3
Seviye 2: 4
cevap: [1, 3, 4]Example Test Scenarios (3)
Example 1
Input:
[[1,2,3,null,5,null,4]]Expected Output:
[1,3,4]Example 2
Input:
[[1,null,3]]Expected Output:
[1,3]Example 3: Boş Ağaç
Input:
[[]]Expected Output:
[]