Track Top-2 Maximum Among N Children
Asked at Nuro · Coding Questions · Difficulty: Easy
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** value using a single pass that maintains two variables `max1` and `max2`.
Loading the problem…
More Nuro interview questions
- Thread-Safe Cache with Lock and Condition Variable
- Thread-Safe Job Scheduler with Cancellation
- Design a Multistage CPU and GPU Job Scheduler
- Cumulative Deduped Time Calculation
- Merge Detections from Multiple Vision Systems (Bounding Box Fusion)
- Reveal Cells After a Click