Count Odd Numbers in an Interval Range
<-E 1523> Count Odd Numbers in an Interval Range
class Solution {
public:
int countOdds(int low,int high) {
return (high - low + high % 2 + low % 2) / 2;
}
};
class Solution {
public:
int countOdds(int low,int high) {
return (high - low + high % 2 + low % 2) / 2;
}
};