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

Brushstrokes: innovators of the first century

The start of the journey from the fine details of Jan van Eyck and those in the Northern Renaissance to the Impressionists, with close-ups of Bellini, del Piombo and Parmigianino's paintings.

via The Eclectic Light Company

Claude Fable is relentlessly proactive

via Simon Willison

Who Runs the Ransomware Group ‘The Gentlemen?’

A cybercrime group known as The Gentlemen has emerged as the second most active ransomware gang by victim count, rapidly attracting a talented pool of hackers through an aggressive recruitment strategy that promises affiliates 90 percent of any ransom paid by victims. This post examines clues pointi...

via Krebs on Security