Skip to content

Commit 944a8b5

Browse files
authored
Create 1523. Count Odd Numbers in an Interval Range1 (#952)
2 parents d49016d + b59ddea commit 944a8b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public:
3+
int countOdds(int low, int high) {
4+
return (high+(high&1)-low+(low&1))>>1;
5+
}
6+
};

0 commit comments

Comments
 (0)