climbers gives each participant's skill level, the array routes gives the difficulty of each route, and points[j] is how many points route j is worth.
A participant with skill s can complete route j when routes[j] ≤ s. Each participant tries every route independently of the others and never gets tired, but can count each route only once.
Return an array of the same length as climbers whose i-th element is the largest total score the i-th participant can earn.climbers=[3, 1, 6], routes=[2, 5, 1, 3], points=[4, 10, 1, 7] → [12, 1, 22]
The climber with skill 3 completes the routes of difficulty 2, 1 and 3: 4 + 1 + 7 = 12. Skill 1 completes only the difficulty-1 route: 1 point. Skill 6 completes every route: 22.
climbers=[2, 2], routes=[4, 9], points=[5, 5] → [0, 0]
Both routes are harder than either climber's skill, so both score 0.
climbers=[5], routes=[5, 5, 6], points=[2, 3, 100] → [5]
Routes of difficulty exactly 5 are within reach, the one of difficulty 6 is not: 2 + 3 = 5.
climbers.length ≤ 10⁵routes.length = points.length ≤ 10⁵climbers[i], routes[j], points[j] ≤ 10⁹climbers=[3, 1, 6], routes=[2, 5, 1, 3], points=[4, 10, 1, 7]
[12, 1, 22]
Run checks the first 3 tests in your browser. Submit checks all 110 tests on the server, hidden ones included.