Range bitwise AND

Write codeMedium20 min

Your task

Given two non-negative integers lo and hi with lo <= hi (both < 2^31), return the bitwise AND of every integer in the inclusive range [lo, hi]. Do it in O(log) without iterating the whole range. For example AND of [5,7] is 4.

Examples

range_bitwise_and(lo: int, hi: int) -> int
Example 1
Inputrange_bitwise_and(5, 7)
Output4