LeetCode solutions

3429. Special Array I

My accepted C++ solution to LeetCode problem 3429, Special Array I, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 27.7MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 27.7MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    bool isArraySpecial(vector<int>& nums) {
        for (int i = 1; i < nums.size(); i++)
        if ((nums[i] & 1) == (nums[i-1] & 1)) return false;
        return true;
    }
};

Source