Skip to content

Commit 9bd3798

Browse files
authored
Update Solution2.py
1 parent ee6f6a1 commit 9bd3798

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
class Solution:
22
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
3+
return any(x & arr[i + 1] & arr[i + 2] & 1 for i, x in enumerate(arr[:-2]))

0 commit comments

Comments
 (0)