Problem 1448 · Medium

Count Good Nodes in Binary Tree

Walk down the tree carrying the largest value seen on the path; a node is good when it is at least that large.

Open the interactive visualisation