find minimum of left ( i , j ) , right ( i , j ) , top ( i , j ) , bottom ( i , j )
let len = Math . min ( Math . min ( top [ i ] [ j ] , bottom [ i ] [ j ] ) , Math . min ( left [ i ] [ j ] , right [ i ] [ j ] ) ) ;