Bitwise AND of Numbers Range

Medium · Bit Manipulation · about 15 minutes

Asked at Amazon, Google, Microsoft.

left and right satisfy 0 <= left <= right <= 2³¹ − 1. Combine every integer from left to right (inclusive) with bitwise AND and return the result.