java.lang.Object
g0201_0300.s0201_bitwise_and_of_numbers_range.Solution

public class Solution extends Object
201 - Bitwise AND of Numbers Range.<p>Medium</p> <p>Given two integers <code>left</code> and <code>right</code> that represent the range <code>[left, right]</code>, return <em>the bitwise AND of all numbers in this range, inclusive</em>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> left = 5, right = 7</p> <p><strong>Output:</strong> 4</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> left = 0, right = 0</p> <p><strong>Output:</strong> 0</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> left = 1, right = 2147483647</p> <p><strong>Output:</strong> 0</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= left <= right <= 2<sup>31</sup> - 1</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • rangeBitwiseAnd

      public int rangeBitwiseAnd(int left, int right)