3151-special-array-i

DevGod
Vtuber
/** * @param {number[]} nums * @return {boolean} */var isArraySpecial = function(nums) { for(let I = 0; I<nums.length-1; I++){ if(nums[I]%2 === nums[I+1]%2){ return false; } } return true;};
class Solution: def isArraySpecial(self, nums: List[int]) -> bool: return all(nums[I]%2 != nums[I+1]%2 for I in range(len(nums)-1))
function isArraySpecial(nums: number[]): boolean { return nums.every( (el,I)=>nums[I]%2!=nums[ I<nums.length ? I+1 : nums.length-1]%2)};