The school cafeteria serves circular and square sandwiches, represented by
The sandwiches are arranged in a stack. At each step, if the student at the front of the queue prefers the sandwich on top of the stack, they take it and leave the queue. Otherwise, they leave the sandwich on the stack and move to the end of the queue.
This process repeats until none of the students remaining in the queue want to take the top sandwich, making it impossible for anyone to proceed.
Return the number of students who are unable to eat.
Constraints:
students.length, sandwiches.length
students.length sandwiches.length
sandwiches[i] is either
students[i] is either
The school cafeteria serves circular and square sandwiches, represented by
The sandwiches are arranged in a stack. At each step, if the student at the front of the queue prefers the sandwich on top of the stack, they take it and leave the queue. Otherwise, they leave the sandwich on the stack and move to the end of the queue.
This process repeats until none of the students remaining in the queue want to take the top sandwich, making it impossible for anyone to proceed.
Return the number of students who are unable to eat.
Constraints:
students.length, sandwiches.length
students.length sandwiches.length
sandwiches[i] is either
students[i] is either