Solved LeetCode program · 104 of 1,000
#0104 · Maximum Depth of Binary Tree
Original English source
Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared deepest of 0.
To measure from node (a whole number) with depth (a whole number). If node is less than 0, return. If depth is more than deepest, set deepest to depth. Measure from item node of lefts with depth plus 1. Measure from item node of rights with depth plus 1.
Measure from 0 with 1. Show deepest.
Expected stdout
3