Skip to content

Commit 03aea65

Browse files
Create 1523-count-odd-numbers-in-an-interval-range.py
File(s) Added: 1523-count-odd-numbers-in-an-interval-range.py Language(s) Used: python Submission URL: https://leetcode.com/problems/count-odd-numbers-in-an-interval-range/submissions/1114260447/
1 parent a39dedc commit 03aea65

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def countOdds(self, low: int, high: int) -> int:
3+
if low%2!=0 or high%2!=0:
4+
return (high-low)//2 +1
5+
return (high-low)//2

0 commit comments

Comments
 (0)