from typing import List
class Solution:
def isArraySpecial(self, nums: List[int]) -> bool:
is_odd = nums[0] % 2 == 0
for i in range(1, len(nums)):
odd = nums[i] % 2 == 0
if odd == is_odd:
return False
is_odd = odd
return True
Search
Aug 14, 20241 min read
from typing import List
class Solution:
def isArraySpecial(self, nums: List[int]) -> bool:
is_odd = nums[0] % 2 == 0
for i in range(1, len(nums)):
odd = nums[i] % 2 == 0
if odd == is_odd:
return False
is_odd = odd
return True