• + 0 comments

    public static int bitwiseAnd(int n, int k) { int max = 0; for (int i = 1; i <= n; i++) { if (i == k-1) continue; int val = i&(k-1); if (val > max && val < k) max = val; } return max; }

    }