Leetcode 199. Binary Tree Right Side View

Input: root = [1,2,3,null,5,null,4]
Output: [1,3,4]
Input: root = [1,null,3]
Output: [1,3]
Input: root = []
Output: []
  • The number of nodes in the tree is in the range [0, 100].
  • -100 <= Node.val <= 100
  1. need to check all the route and track the depth on each node. Starting on the most right node.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gary Chiang

Gary Chiang

19 Followers

CS new grad, 6 years experience related to supply chain management. Located in Bay area