Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
359 B
2
Indexable
Never
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;
    }
};
Leave a Comment