JuniorMath

Count Odd Numbers in an Interval Range

Given two non-negative integers low and high, return the count of odd numbers between low and high, inclusive.

Example 1
Inputlow = 3, high = 7
Output3
The odd numbers between 3 and 7 are [3, 5, 7].
Example 2
Inputlow = 8, high = 10
Output1
The odd numbers between 8 and 10 are [9].

Constraints

  • 0 <= low <= high <= 10^9

Asked at 4 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate