【leetcode_easy_math】1523. Count Odd Numbers in an Interval Range

problem

1523. Count Odd Numbers in an Interval Range

solution#1: 分别计算0到low-1和0到high的奇数数目,然后做差即可。

code

 

solution#2:根绝high和low的奇偶性判断。

code

 

参考

1. leetcode_easy_math_1523. Count Odd Numbers in an Interval Range;

posted on 2021-04-26 23:19  鹅要长大  阅读(54)  评论(0编辑  收藏  举报

导航