Event Time
Feel free to checkout the image source at the bottom of the page for the original problem statement 🦜
Imagine an exclusive event that everyone is eager to attend. The doors open at time 0, and people begin to arrive, each with their own special time of arrival, counted in seconds since the start of the event. But there’s a little twist — before anyone can step inside, they must go through a thorough ID check. This check takes exactly 5 minutes (or 300 seconds) per person. Now, here’s where things get tricky: if a person arrives and sees that there are already more than 10 people waiting in line for the ID check, they decide to leave immediately. They simply cannot bear the wait and head home without ever getting their ID checked. Your task is to determine the time each person will finish their ID check, starting from the time they arrived at the event. If someone leaves upon arrival because the queue is too long, their “processed” time will be the same as their arrival time — no ID check for them! Here are a few more things to keep in mind: The queue size is determined by how many people are waiting to begin their ID check. The person currently getting checked doesn’t count toward the queue. If multiple people arrive at exactly the same moment and the queue grows, the person who has fewer people ahead of them will be processed first, while the others will patiently wait their turn. Your goal is to return an array of integers where each number represents the exact moment in seconds when a person finishes their ID check — or if they left immediately, it’s simply their arrival time. Now, go ahead and figure out who gets into this exclusive event and when their ID checks are complete!
1Example 1
2Example 2
Constraints
Limits and guarantees your solution can rely on.
Unknown for now