Class Solution
java.lang.Object
g1501_1600.s1523_count_odd_numbers_in_an_interval_range.Solution
1523 - Count Odd Numbers in an Interval Range.<p>Easy</p>
<p>Given two non-negative integers <code>low</code> and <code>high</code>. Return the <em>count of odd numbers between</em> <code>low</code> <em>and</em> <code>high</code>_ (inclusive)_.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> low = 3, high = 7</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong> The odd numbers between 3 and 7 are [3,5,7].</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> low = 8, high = 10</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Explanation:</strong> The odd numbers between 8 and 10 are [9].</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 <= low <= high <= 10^9</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
countOdds
public int countOdds(int low, int high)
-