Hackerrank
Last updated
Was this helpful?
Last updated
Was this helpful?
Given an array, tickets, of n positive integers describing initial sequence of people standing in line. Each ticketsi describes number of tickets that a person waiting at initial place. An integer p, denoting Jesse's position in tickets. Return the waiting time
Divide array by index p.
In first half, count the number only it is greater than ticket[i], otherwise return p
In second half the same, but return number - 1