Consider all cells of top row as starting point
res = 0 ; NEW_LINE for j in range ( n ) : NEW_LINE INDENT res = max ( res , largestZigZagSumRec ( mat , 0 , j , n ) ) ; NEW_LINE DEDENT return res ; NEW_LINE