• + 0 comments

    one liner preventing exceeding time limit:

    def bitwiseAnd(N, K):
        return max((a+1)&(K-1) for a in range(N) if K-1 != a+1)