The answer is the number of subsets of all lengths from set arr [ 0. . n - 1 ] having XOR of elements as k
$ ans = 0 ; for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) { $ ans += $ dp [ $ n ] [ $ K ] [ $ i ] ; } return $ ans ; }