Finding the result with given condition
let res = ( Math . pow ( 2 , i ) - 1 ) * ( Math . pow ( 2 , j ) - 1 ) * Math . pow ( 2 , n - i - j ) ; return res ; } function count ( arr , value ) { let sum = 0 ; for ( let i = 0 ; i < arr . length ; i ++ ) if ( arr [ i ] == value ) sum ++ ; return sum ; }