1
var mostPoints = function (questions) {
2
let totalQuestions = questions.length;
3
let map = new Map();
4

5
const helper = (index) => {
6
if (map.has(index)) {
7
return map.get(index);
8
}
9

10
if (index >= totalQuestions) {
11
return 0;
12
}
13

14
let solve = questions[index][0] + helper(index + questions[index][1] + 1);
15
let skip = helper(index + 1);
16
let res = Math.max(solve, skip);
17
map.set(index, res);
18

19
return res;
20
};
21

22
return helper(0);
23
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0