Trains the technique from
LeetCode 1523Count Odd Numbers in an Interval RangeThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Return how many odd numbers lie in the range from low to high, counting both ends.
Example 1
The odd numbers from 1 to 10 are 1, 3, 5, 7 and 9.
Example 2
The range holds a single number and it is even.
Example 3
The range holds a single number and it is odd.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def count_odds(low: int, high: int) -> int:public int countOdds(int low, int high)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.