Compare the Triplets
EasyP3Coding
Alice's ratings are a[0..2] and Bob's are b[0..2]. Compare them position by position. Whoever has the higher rating at a position gets one point; a tie gives nobody a point. Return [aliceScore, bobScore].
Example 1
- Input
- a = [5,6,7], b = [3,6,10]
- Output
- [1,1]
- Why
- Alice wins position 0, ties position 1 and loses position 2, so each scores 1.
Example 2
- Input
- a = [17,28,30], b = [99,16,8]
- Output
- [2,1]
- Why
- Alice wins positions 1 and 2, Bob wins position 0.
Example 3
- Input
- a = [1,1,1], b = [1,1,1]
- Output
- [0,0]
Constraints
- a.length == b.length == 3
- 1 <= a[i], b[i] <= 100
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 8. ⌘Enter runs, ⌘⇧Enter submits.