leetcode 1550. 存在连续三个奇数的数组-耗时100-Three Consecutive Odds

张开发
2026/5/24 13:23:54 15 分钟阅读
leetcode 1550. 存在连续三个奇数的数组-耗时100-Three Consecutive Odds
Problem: 1550. 存在连续三个奇数的数组-耗时100-Three Consecutive Odds耗时100%检查连续的三个数字是否奇数Codeclass Solution { public: bool threeConsecutiveOdds(vectorint arr) { int n arr.size(); for(int i 0; i n - 2; i) { if((arr[i]1)1 (arr[i1]1)1 (arr[i2]1)1) { return true; } } return false; } };

更多文章