

VEC[][]= {{5, 10}, {25, 15}}

All the rectangles denote the possible falling paths. The rectangle with red filler is the minimum falling path with the minimum falling path sum of 20 (5+15).
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test contains an integer ‘N’ denoting the number of rows and columns.
The next ‘N’ lines of each test case contain ‘N’ space-separated integers denoting the elements of the square array.
For each test case, print a single integer the minimum sum of a falling path through the square array.
The output of each test case will be printed in a separate line.
You don’t need to print anything; it has already been taken care of. Just return the minimum sum calculated.
1 <= T <= 50
1 <= N <= 100
-10^7 <= VEC[i][j] <=10^7
Where ‘T’ is the total number of test cases, ‘N’ denotes the number of rows and columns in the array, and ‘VEC[i][j]’ denotes the range of elements in the 2 Dimensional array.
Time limit: 1 second
Since the difference between the previous ‘ROW’ ‘COLUMN’ number and the current ‘ROW’ ’COLUMN’ number should be at most one, the possible next step from point A[‘ROW’ ][‘COLUMN’] will be A[‘ROW’ +1][‘COLUMN’-1], A[‘ROW’+1][‘COLUMN’] and A[‘ROW’+1][‘COLUMN’+1]. So, the idea is to traverse these possible paths and keep storing the minimum result for each ‘COLUMN’. Finally, return the minimum of all the values of each ‘COLUMN’.