We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26723fc commit ea7a7e8Copy full SHA for ea7a7e8
src/main/java/g3101_3200/s3101_count_alternating_subarrays/Solution.java
@@ -12,13 +12,13 @@ public long countAlternatingSubarrays(int[] nums) {
12
if (nums[end] != nums[end - 1]) {
13
end++;
14
} else {
15
- length = end - start;
+ length = end - (long) start;
16
count += (length * (length + 1)) / 2;
17
start = end;
18
19
}
20
21
+ length = end -(long) start;
22
23
return count;
24
0 commit comments