Loading Company...
This is a verified interview question from Google. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Ticket Queue Score - Google OA IIIT Allahabad" covers key patterns like Other.
"### Problem You are given an array A of length N. Processing the array from left to right: * If A[i] > 0, a group containing A[i] tickets is added to the end of a queue. * If A[i] = 0, the earliest unprocessed group in the queue is removed, and its size is added to the score. * If the queue is empty, nothing happens. Find the final score. ### Input * First line: N * Second line: N space-separated integers A[i] ### Output * Print the final score."
Join thousands of developers practicing for Google.