Search
⌘K

Leetcode 2593. Find Score of an Array After Marking All Elements

Repeatedly pick the smallest unmarked element (ties by smallest index), add its value to the score, and mark that element and its immediate neighbors until all elements are marked; return the total score. The core challenge is efficiently simulating this greedy selection and neighbor-marking for up to 1e5 elements.


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.