Bitwise AND of Numbers Range Problem

Bitwise AND of Numbers Range Problem — ExecCode Easy DSA Practice

Solve the Bitwise AND of Numbers Range problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.

Examples

Input {"left": 5, "right": 7}; Output 4. Input {"left": 0, "right": 0}; Output 0. Input {"left": 1, "right": 2147483647}; Output 0

Constraints

0 <= left <= right <= 2^31 - 1

Practice Bitwise AND of Numbers Range free on ExecCode. Browse DSA problems, topic map, and placement guides.