• + 0 comments

    Python 3

    def bitwiseAnd(N, K):
        # Write your code here
        tot = 0
        for j in range(N):
            if (j+1) != (K-1):
                ba = (K-1)&(j+1)
                tot = max(ba, tot)
        return tot