We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95e85b5 commit 32bbfcaCopy full SHA for 32bbfca
1523. Count Odd Numbers in an Interval Range
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int countOdds(int low, int high) {
3
+ int total = high - low +1;
4
+ if(total%2==0){
5
+ return total/2;
6
+ }
7
+ else{
8
+ return total/2 + high%2;
9
10
11
+}
0 commit comments