Search
⌘K

Leetcode 3049. Earliest Second to Mark Indices II

Given initial counts and a time-ordered list of indices that can be "reset" each second, determine the earliest second by which you can schedule per-second actions (decrement any element by 1, reset the designated index to any nonnegative value, or mark an index whose value is 0) to mark every index, or return -1 if impossible. The problem is a scheduling/resource-allocation feasibility question—typically solved by checking if all indices can be marked by time t (using greedy accounting of available resets and decrements) and binary-searching the minimum t.


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.