Skip to content

Practice Maximum Points in an Archery Competition

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2212
LeetCode Problem

Maximum Points in an Archery Competition

Problem Statement

aliceArrows[k] records Alice arrows in scoring section k, for k from 0 through 11. Allocate exactly numArrows Bob arrows among these sections. Bob earns k points only when he shoots strictly more arrows there than Alice; a tie favors Alice, and a section with no arrows awards neither player points. Return any allocation array maximizing Bob total points.

Source: Maximum Points in an Archery Competition on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
numArrows = 9, aliceArrows = [1,1,0,1,0,0,2,1,0,1,2,0]
Output
[0,0,0,0,1,1,0,0,1,2,3,1]

# Example 2

Input
numArrows = 3, aliceArrows = [0,0,1,0,0,0,0,0,0,0,0,2]
Output
[0,0,0,0,0,0,0,0,1,1,1,0]

Constraints

1 <= numArrows <= 10^5
aliceArrows.length == bobArrows.length == 12
0 <= aliceArrows[i], bobArrows[i] <= numArrows
sum(aliceArrows[i]) == numArrows

Related LeetCode Problems

Practice more problems similar to Maximum Points in an Archery Competition.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.