Waiting in line at Sam's

Computer Science Level 4

This text file describes the activity in the line at Sam's ice cream shop yesterday.

When customers enter the line, they are arbitrarily assigned a number. This action is represented by the string "ENTER ###", where ### is the customer number.

When the customer at the front of the line receives their ice cream, they leave the line. This action is represented by the string "LEAVE".

Assume no customer leaves the line until they reach the front and receive their ice cream. If "LEAVE" appears when nobody is in line, there are no changes to the line.

Take this example:


In this example, customers 234, 142, and 200 entered the line. Then 234 left, followed by 142. In the end, only customer 200 was still in line.

Click here to open the text file describing the line activity yesterday. Assume the line was empty to begin with.

Let S be the sum of the customer numbers who were still in line at the end of yesterday. What are the last 3 digits of S?


Problem Loading...

Note Loading...

Set Loading...