Skip to content

Commit 03d30a6

Browse files
committed
Adding readme file
1 parent f32e3b8 commit 03d30a6

File tree

1 file changed

+29
-0
lines changed
  • 2962-CountSubarraysWhereMaxElementAppearsatLeastKTimes

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
You are given an integer array nums and a positive integer k.
2+
3+
Return the number of subarrays where the maximum element of nums appears at least k times in that subarray.
4+
5+
A subarray is a contiguous sequence of elements within an array.
6+
7+
 
8+
Example 1:
9+
10+
Input: nums = [1,3,2,3,3], k = 2
11+
Output: 6
12+
Explanation: The subarrays that contain the element 3 at least 2 times are: [1,3,2,3], [1,3,2,3,3], [3,2,3], [3,2,3,3], [2,3,3] and [3,3].
13+
14+
15+
Example 2:
16+
17+
Input: nums = [1,4,2,1], k = 3
18+
Output: 0
19+
Explanation: No subarray contains the element 4 at least 3 times.
20+
21+
22+
 
23+
Constraints:
24+
25+
26+
1 <= nums.length <= 105
27+
1 <= nums[i] <= 106
28+
1 <= k <= 105
29+

0 commit comments

Comments
 (0)