Question: Please help to write two functions in C++ , the instruction as following. I will rate the answer :) THANKS!! Movie Theatre Shuffle You work
Please help to write two functions in C++ , the instruction as following. I will rate the answer :) THANKS!!


Movie Theatre Shuffle You work at a movie theatre, ushering people to their assigned seats. There are S seats, all in one row, and the seats are numbered 1 through S (starting from the left, in increasing order). There are S customers in line, each of whom has a unique seat they're assigned to Once seated, a customer will not leave their seat until the film is over. Additionally, it takes you one minute to escort a customer to their seat. An E-set is a contiguous section of seats such that there are exactly E empty seats next to one another, and there are no empty seats immediately to the left or right of this section For instance, this row of length 8 consists of one 1-set and one 6-set Seat 1 Customer Seat 3 Seat 4 Seat 5 Seat 6 Seat 7 Seat 8 (Empty) (Empty) (Empty) (Empty) (Empty) (Empty) (Empty) This is because there is 1 empty seat to the left of the only customer and 6 empty seats to the right. Even though there are smaller groups of 5, 4, 3, 2, and 1 empty seats to the right of this customer, each of those groups is directly next to an empty seat, so we only look at the largest grouping Your Task Given a line of S customers, write a function that returns the earliest time that a certain E-set occurs (or -1 if it never occurs) int solution (const std::vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
