Count Odd Numbers in an Interval Range
class Solution:
def countOdds(self, low: int, high: int) -> int:
if not (low % 2) and not (high % 2):
return (high - low) // 2
else:
return 1 + (high - low) // 2
class Solution:
def countOdds(self, low: int, high: int) -> int:
if not (low % 2) and not (high % 2):
return (high - low) // 2
else:
return 1 + (high - low) // 2