Count Odd Numbers in an Interval Range

Problem

Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive).

Example 1:

Input: low = 3, high = 7
Output: 3
Explanation: The odd numbers between 3 and 7 are [3,5,7].

Example 2:

Input: low = 8, high = 10
Output: 1
Explanation: The odd numbers between 8 and 10 are [9].

Constraints:

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

Solution

Recent posts from blogs that I like

Masaccio’s six years

His first painting as a Master in his own right was in 1422. He built depth and realism into faces and figures, and mastered 3D perspective projection, then 6 years later vanished in Rome, reported dead.

via The Eclectic Light Company

AI is driving a boom in modestly successful software projects

If AI is so great, why aren’t we seeing an explosion of new, amazing software products? If anyone can turn their idea into working software with coding agents, where is all that software? People have been asking this question for years. As far as I can tell, the answer is that it’s spread out over a...

via Sean Goedecke

How is music possible

If you take a scene from a horror movie and add funny music, the killer suddenly looks hilarious. Isn’t it strange that that happens?

via Henrik Karlsson