• + 1 comment
    def bitwiseAnd(N, K):
        if (K - 1) | K <= N:
            return K - 1
        return K - 2
    

    the max value before k will be k-1 is it exists print k-1 else k-2 the next largest value before k-1