Solved LeetCode program · 477 of 1,000
#0671 · Second Minimum Node In a Binary Tree
Original English source
Keep a shared values holding 2, 2, 5, 5, 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 base of 0. Keep a shared higher of 0.
To inspect from node (a whole number). If node is less than 0, return. The value is item node of values. If value is more than base and value is less than higher, set higher to value. Inspect from item node of lefts. Inspect from item node of rights.
Set base to item 0 of values. Set higher to 1000000. Inspect from 0. If higher is 1000000, show -1, otherwise show higher.
Expected stdout
5