Skip to content

Commit 75aa21e

Browse files
committed
Time: 1 ms (100%), Space: 45.4 MB (20.37%) - LeetHub
1 parent 88b6b43 commit 75aa21e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public int countSubarrays(int[] nums) {
3+
int res = 0;
4+
for (int i = 0; i < nums.length - 2; i++) {
5+
if ((nums[i] + nums[i + 2]) * 2 == nums[i + 1]) {
6+
res++;
7+
}
8+
}
9+
return res;
10+
}
11+
}

0 commit comments

Comments
 (0)