Find the largest sum by considering all possible next elements in sequence .
$ zzs = 0 ; for ( $ k = 0 ; $ k < $ n ; $ k ++ ) if ( $ k != $ j ) $ zzs = max ( $ zzs , largestZigZagSumRec ( $ mat , $ i + 1 , $ k , $ n ) ) ; return $ zzs + $ mat [ $ i ] [ $ j ] ; }