/**
* @param {number[]} tickets
* @param {number} k
* @return {number}
*/
var timeRequiredToBuy = function(tickets, k) {
let time = 0;
while (tickets[k] > 0) {
for (let i = 0; i < tickets.length; i++) {
if (tickets[k] === 0) break;
if (tickets[i] <= 0) continue;
tickets[i]--;
time++;
}
}
return time;
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)