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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
C++
Accepted on LeetCode — runtime 0ms, memory 27.7MB, accepted 2025-12-27.
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;
}
};