leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1550.cpp (302B)
0 class Solution {
1 public:
2 bool threeConsecutiveOdds(const vector<int> &arr) const {
3 int cnt = 0;
5 for (const int n : arr) {
6 if (n % 2 == 0)
7 cnt = 0;
8 else if (++cnt == 3)
9 return true;
10 }
12 return false;
13 }
14 };