Skip to content

Commit

Permalink
Create 1523-count-odd-numbers-in-an-interval-range.py
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
PavanCheruvupally authored Dec 7, 2023
1 parent a39dedc commit 03aea65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/1523-count-odd-numbers-in-an-interval-range.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Solution:
def countOdds(self, low: int, high: int) -> int:
if low%2!=0 or high%2!=0:
return (high-low)//2 +1
return (high-low)//2

0 comments on commit 03aea65

Please sign in to comment.