3874. Valid Subarrays With Exactly One Peak
ArrayMath
Hints
Hint 1
Gather peak indices and find the boundaries where each is the only peak.
Hint 2
Calculate how far the left and right endpoints for each peak can extend under the constraints.
Hint 3
Sum the product of the possible left and right endpoints for each peak.
Preparing judge…