Search
⌘K

Leetcode 3187. Peaks in Array

Given an array where a "peak" is an element greater than its immediate neighbors, process up to 1e5 queries that either update a single element or ask for the number of peaks in a subarray. The challenge is to support fast point updates and range peak-count queries (updates only affect a constant local neighborhood), so use a dynamic range-sum structure (e.g., segment tree/Fenwick) over peak indicators.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.