Skip to content

Commit b456065

Browse files
committed
add solution in rust: 1523. Count Odd Numbers in an Interval Range
Signed-off-by: rajput-hemant <rajput.hemant2001@gmail.com>
1 parent 611588a commit b456065

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
impl Solution {
2+
pub fn count_odds(low: i32, high: i32) -> i32 {
3+
// ((high + 1) / 2) - (low / 2)
4+
((high + 1) >> 1) - (low >> 1) // same as above
5+
}
6+
}

0 commit comments

Comments
 (0)