IndexOutOfBoundsException triggered | LeetCode Where will the ball fall
Link to the puzzle description https://leetcode.com/problems/where-will-the-ball-fall/description/
I have been fighting with this puzzle for more than a month. Still my code cannot output correctly.
I tried this testcase
And my WIP code (it triggers IndexOutOfBoundsException at line
I have been fighting with this puzzle for more than a month. Still my code cannot output correctly.
I tried this testcase
Input: grid = [[1,1,1,-1,-1],[1,1,1,-1,-1],[-1,-1,-1,1,1],[1,1,1,1,-1],[-1,-1,-1,-1,-1]]
Output: [1,-1,-1,-1,-1]And my WIP code (it triggers IndexOutOfBoundsException at line
int currRow = 0. Could anyone kindly point me in the right direction?: