Exclusive Event Entry
Feel free to check out the image source below for the original statement 🦖
Imagine you’re organizing a grand, exclusive event that has everyone buzzing with excitement. The event kicks off at time 0, and guests start arriving at various times, measured in seconds since the event began. To attend, each guest must go through an ID check, which takes a precise 5 minutes (or 300 seconds) to complete. However, there’s a rule that adds a bit of drama: if a guest arrives and finds that there are already more than 10 people waiting in line for their ID check, they decide to leave right away, without going through the process. Your mission is to figure out when each guest will finish their ID check. If a guest leaves because the queue is too long, their completion time will be the same as their arrival time. Here’s how things work: The queue size is determined by how many people are waiting to start their ID check. The person currently being checked isn’t counted in this queue size. If a new guest arrives exactly when another person finishes their ID check, the guest who was waiting in line will be processed first. The new arrival will join the queue, waiting for their turn. Your task is to create a function named solution that takes an array of arrival times as input and returns an array where each entry shows when the guest’s ID check will be completed. If a guest leaves due to a long queue, their completion time should match their arrival time. Get ready to dive into the world of exclusive event management and determine who gets their ID checked and when!
1Example 1
2Example 2
Constraints
Limits and guarantees your solution can rely on.
Unknown for now