function to initialize arrays
function solve ( n ) { for ( let i = 0 ; i <= n ; i ++ ) { dp [ i ] = - 1 ; } for ( let i = 0 ; i <= n ; i ++ ) { for ( let j = 0 ; j <= n ; j ++ ) { nck [ i ] [ j ] = - 1 ; } } let currLog2 = - 1 ; let currPower2 = 1 ;