题目描述:
https://leetcode-cn.com/problems/three-consecutive-odds/
Java代码:
class Solution {public boolean threeConsecutiveOdds(int[] a) {for(int i=2;i<a.length;i++){if(a[i]%2==1&&a[i-1]%2==1&&a[i-2]%2==1)return true;}return false;}
}
Java代码二:
class Solution {public boolean threeConsecutiveOdds(int[] a) {for(int i=2;i<a.length;i++){if(a[i]%2==1){if(a[i-1]%2==1&&a[i-2]%2==1)return true;}else i+=2;}return false;}
}