Search
⌘K

Leetcode 3080. Mark Elements on Array by Performing Queries

Given nums and queries where each query marks a specified index (if not already) and then marks up to k currently-unmarked elements with the smallest values (ties broken by index), return the sum of unmarked elements after each query. The core challenge is efficiently maintaining the dynamic set of unmarked elements ordered by (value, index) and updating the total sum across up to 1e5 operations.


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.