NvidiaOA #8
Last Robot Score
估计简单评测数据准备中,可先阅读题面
考点(AI 标注)单调栈与堆
Robots compete by score. While at least two robots remain, take the two
Constraints
The competition always uses the two currently highest scores.
Example 1
Input:
scores = [10,4,7,3]
Output:
2
Explanation: 10 and 7 leave 3, then 4 and 3 leave 1, then 3 and 1 leave 2. The last remaining robot has score 2.
Example 2
Input:
scores = [8,5,3]
Output:
0
Explanation: 8 and 5 leave 3, then the two 3s cancel.