find value of rows having first column value equal to zero
for ( var i = 0 ; i < n ; ++ i ) { if ( A [ i ] [ 0 ] == 0 ) { var ans = 0 ; for ( var j = 1 ; j < m ; ++ j ) ans = ans + A [ i ] [ j ] * Math . pow ( 2 , m - j - 1 ) ; update . set ( ans , i ) ; } }