1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/数字范围按位与 [bitwise-and-of-numbers-range].html

33 lines
760 B
HTML
Raw Normal View History

2022-03-27 20:56:26 +08:00
<p>给你两个整数 <code>left</code><code>right</code> ,表示区间 <code>[left, right]</code> ,返回此区间内所有数字 <strong>按位与</strong> 的结果(包含 <code>left</code><code>right</code> 端点)。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>left = 5, right = 7
<strong>输出:</strong>4
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>left = 0, right = 0
<strong>输出:</strong>0
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>left = 1, right = 2147483647
<strong>输出:</strong>0
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 <= left <= right <= 2<sup>31</sup> - 1</code></li>
</ul>