정수 low와 high가 주어지는데 low 이상, high 이하의 홀수 개수를 구하는 문제
class Solution {
public:
int countOdds(int low, int high) {
bool lowIsOdd{low % 2 == 0 ? false : true};
bool highIsOdd{high % 2 == 0 ? false : true};
int min{(high - low) >> 1};
return min + ((lowIsOdd || highIsOdd) ? 1 : 0);
}
};