Untitled
unknown
plain_text
a year ago
359 B
7
Indexable
class Solution {
public:
bool isOdd(int num) {
return num & 1;
}
bool threeConsecutiveOdds(vector<int>& arr) {
if(arr.size() < 3) return false;
for(int i=2;i<arr.size();i++) {
if(isOdd(arr[i]) && isOdd(arr[i-1]) && isOdd(arr[i-2]))return true;
}
return false;
}
};Editor is loading...
Leave a Comment