1
var maximumBobPoints = function (numArrows, aliceArrows) {3
n = aliceArrows.length,5
backtrack(numArrows, 0, 0, Array(n).fill(0));8
function backtrack(arrows, idx, points, bobArrows) {9
if (idx === n || arrows === 0) {10
let origVal = bobArrows[n - 1];11
if (arrows > 0) bobArrows[n - 1] += arrows; // put extra arrows in any slot16
bobArrows[n - 1] = origVal;20
backtrack(arrows, idx + 1, points, bobArrows); // don't use any arrows21
if (aliceArrows[idx] + 1 <= arrows) {22
// use aliceArrows[idx] + 1 arrows to gain idx points23
bobArrows[idx] = aliceArrows[idx] + 1;25
arrows - (aliceArrows[idx] + 1),