Skip to content

Commit a7c361a

Browse files
committed
Add C++ solution of problem #3151
1 parent 9397d7b commit a7c361a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

3151/solution.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
bool isArraySpecial(vector<int>& A) {
4+
int n = A.size();
5+
for(int i = 1; i < n; i++) {
6+
int j = i - 1;
7+
if(((A[i] ^ A[j]) % 2) == 0)
8+
return false;
9+
}
10+
return true;
11+
}
12+
};

0 commit comments

Comments
 (0)