We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 29: Bitwise AND
Day 29: Bitwise AND
Sort by
recency
|
430 Discussions
|
Please Login in order to post a comment
in python -
def bitwiseAnd(N, K): if K - 1 | K <= N: return K -1 else: return K-2
any one explain why this code works always int bitwiseAnd(int n, int k) { if (((k - 1) | k) <= n) { return k - 1; } else { return k - 2; } }
PYTHON 3 SOLUTION
python:
JavaScript/TypeScript