Skip to content

Commit 4ef024e

Browse files
committed
Add C++ solution of problem #3392
1 parent 8823cf4 commit 4ef024e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

3392/solution.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public:
3+
int countSubarrays(vector<int>& A) {
4+
int ans = 0;
5+
for(int i = 0; i < A.size() - 2; i++) {
6+
int a = A[i];
7+
int b = A[i + 1];
8+
int c = A[i + 2];
9+
if(2 * (a + c) == b)
10+
ans++;
11+
}
12+
return ans;
13+
}
14+
};

0 commit comments

Comments
 (0)