Question
A database escalates row locks to a table lock to save memory. A transaction acquires row locks over time. acquisitions is a list of row ids (with possible repeats) acquired in order. The lock manager escalates to a single table-level lock the first moment the number of DISTINCT rows held reaches a threshold. Once escalated, all further row acquisitions are absorbed by the table lock (no new row locks tracked). Re-acquiring an already-held row before escalation does not increase the distinct count. Return the 1-based index in 'acquisitions' at which escalation is triggered, or -1 if escalation never happens.
lock_escalation_point(acquisitions: list[int], threshold: int) → int[[1,2,2,3,4],3]out4State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.