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 + high%2 + low%2;
    }
};
posted @ 2022-05-17 23:17  ReaIms  阅读(17)  评论(0编辑  收藏  举报