mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
23 lines
842 B
HTML
23 lines
842 B
HTML
<p>Given two non-negative integers <code>low</code> and <code><font face="monospace">high</font></code>. Return the <em>count of odd numbers between </em><code>low</code><em> and </em><code><font face="monospace">high</font></code><em> (inclusive)</em>.</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> low = 3, high = 7
|
|
|
|
<strong>Output:</strong> 3
|
|
|
|
<b>Explanation: </b>The odd numbers between 3 and 7 are [3,5,7].</pre>
|
|
|
|
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> low = 8, high = 10
|
|
|
|
<strong>Output:</strong> 1
|
|
|
|
<b>Explanation: </b>The odd numbers between 8 and 10 are [9].</pre>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><code>0 <= low <= high <= 10^9</code></li>
|
|
|
|
</ul> |