Skip to content

Commit f38d991

Browse files
[LEET-3392] add 3392
1 parent 0b3d11c commit f38d991

File tree

2 files changed

+16
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+16
-0
lines changed

paginated_contents/algorithms/4th_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| # | Title | Solutions | Video | Difficulty | Tag
22
|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|------------|----------------------------------------------------------------------
33
| 3396 | [Minimum Number of Operations to Make Elements in Array Distinct](https://leetcode.com/problems/minimum-number-of-operations-to-make-elements-in-array-distinct/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3396.java) | | Easy |
4+
| 3392 | [Count Subarrays of Length Three With a Condition](https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3392.java) | | Easy |
45
| 3370 | [Smallest Number With All Set Bits](https://leetcode.com/problems/smallest-number-with-all-set-bits/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3370.java) | | Easy |
56
| 3364 | [Minimum Positive Sum Subarray](https://leetcode.com/problems/minimum-positive-sum-subarray/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3364.java) | | Easy |
67
| 3360 | [Stone Removal Game](https://leetcode.com/problems/stone-removal-game/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3360.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3392 {
4+
public static class Solution1 {
5+
public int countSubarrays(int[] nums) {
6+
int count = 0;
7+
for (int i = 0; i < nums.length - 2; i++) {
8+
if ((nums[i] + nums[i + 2]) * 2 == nums[i + 1]) {
9+
count++;
10+
}
11+
}
12+
return count;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)