As reported: Visa Senior Software Engineer online assessment on CodeSignal (2025), question 1 of 4: given an array of scores and a target, return the first index where the prefix sum from index 0 reaches or exceeds the target, else
-1.
Given an array scores and an integer target, return the smallest index i such that scores[0] + scores[1] + … + scores[i] ≥ target. If the total of the whole array stays below target, return -1.
Example
scores = [3,1,4,1,5], target = 8 -> 2 (3 + 1 + 4 = 8)
scores = [3,1,4,1,5], target = 20 -> -1 (the total is 14)
scores = [5,2], target = 5 -> 0
Constraints: 1 ≤ scores.length ≤ 10^5; 0 ≤ scores[i] ≤ 10^4; 1 ≤ target ≤ 10^9.
Code runner format: one JSON value per line: scores, then target. Implement firstIndexReaching(scores, target); the harness prints the index.