Description
Students stand in queue for sandwiches. Each student prefers square (0) or circular (1). Return the number of students that are unable to eat because no matching sandwich is available.
Examples
Input:
students = [1,1,0,0], sandwiches = [0,1,0,1]Output:
0Explanation:
All get lunch.
Input:
students = [0,0,0], sandwiches = [1,1,1]Output:
3Explanation:
All 3 students prefer sandwich type 0, but all sandwiches are type 1. Since students can only take from the top of the stack and none want type 1, all students remain unable to eat.
Input:
students = [1,0,1,0,0], sandwiches = [1,0,0,0,1]Output:
1Explanation:
Students wanting type 1: indices 0 and 2. Students wanting type 0: indices 1, 3, 4. Sandwiches (top to bottom): [1,0,0,0,1]. After processing, 1 student is unable to eat because the sandwich at the top does not match any remaining student's preference.
Constraints
- •
1 ≤ n ≤ 100