1295. 统计位数为偶数的数字

int findNumbers(int* nums, int numsSize){
    if (nums == NULL)
        return 0;
    int res = 0;
    for (int i = 0; i < numsSize; i++) {
        int tempNum = nums[i];
        int digitCount = 0;
        while (tempNum > 0) {
            digitCount ++;
            tempNum /= 10;
        }
        if (digitCount % 2 == 0)
            res ++;
    }
    return res;
}

  

posted on 2020-02-04 14:19  luckygxf  阅读(157)  评论(0编辑  收藏  举报

导航