root. Call a node a **record** if no node on the path from the root down to it (the node itself included) holds a larger value.
Return the number of record nodes. The root is always a record.root=tree_node([5, 7, 2, 6, None, 8]) → 3
The root 5 always counts. 7 (path 5→7) is a record. 6 (path 5→7→6) is not, 7 is above it. 2 is not. 8 (path 5→2→8) is a record. Total 3.
root=tree_node([4, 4, None, 4]) → 3
Equal values do not get in the way: all three nodes are records.
root=tree_node([-3]) → 1
root=tree_node([5, 7, 2, 6, None, 8])
3
Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.