Three Consecutive Odds
给一个数组, 问里面有没有连续三个数字是奇数.
class Solution {
public boolean threeConsecutiveOdds(int[] arr) {
int count = 0;
for(int i : arr) {
if(i % 2 != 0)
count++;
else
count = 0;
if(count == 3)
return true;
}
return false;
}
}