Rearrange an array to maximize sum of Bitwise AND of same-indexed elements with another array

#include using namespace std;int maximizeAnd(int i, int mask,                int* A, int* B, int N,                vector& dp){        if (i == N)        return 0;            if (dp[i][mask] != -1)        return dp[i][mask];        for (int j = 0; j < N; ++j) {                        if (!(mask & (1