We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee6f6a1 commit 9bd3798Copy full SHA for 9bd3798
solution/1500-1599/1550.Three Consecutive Odds/Solution2.py
@@ -1,6 +1,3 @@
1
class Solution:
2
def threeConsecutiveOdds(self, arr: List[int]) -> bool:
3
- for i in range(len(arr) - 2):
4
- if arr[i] % 2 + arr[i + 1] % 2 + arr[i + 2] % 2 == 3:
5
- return True
6
- return False
+ return any(x & arr[i + 1] & arr[i + 2] & 1 for i, x in enumerate(arr[:-2]))
0 commit comments