Variant of Snapshot Array / Track top-2 maximum among N children
You are given n child nodes (e.g., in an N-ary tree). Each child has an integer value. While iterating through the n children, find the largest value and (if needed) the second largest val...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
