First Time at a Level
Each row of steps is a walk that starts at 0: after step j it stands at the sum of the row's first j + 1 numbers. Return, for each row, the first j at which the walk stands at level or higher, or -1 if it never does. No loops: for and while are not allowed.
Example 1
steps [[1,2,3],[1,1,1],[5,-5,5]]
level 5
returns [2,-1,0]
Row 0 stands at 1, 3, 6 and passes 5 at step 2. Row 1 only gets to 3. Row 2 is at 5 after its first step.
Constraints
1 <= rows <= 30,1 <= columns <= 30-10 <= steps[r][j] <= 101 <= level <= 40
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.