You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme/1700-number-of-students-unable-to-eat-lunch.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
<h2><ahref="https://leetcode.com/problems/number-of-students-unable-to-eat-lunch/">1700. Number of Students Unable to Eat Lunch</a></h2><h3>Easy</h3><hr><div><p>The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers <code>0</code> and <code>1</code> respectively. All students stand in a queue. Each student either prefers square or circular sandwiches.</p>
1
+
<h2><ahref="https://leetcode.com/problems/number-of-students-unable-to-eat-lunch">1802. Number of Students Unable to Eat Lunch</a></h2><h3>Easy</h3><hr><p>The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers <code>0</code> and <code>1</code> respectively. All students stand in a queue. Each student either prefers square or circular sandwiches.</p>
2
2
3
3
<p>The number of sandwiches in the cafeteria is equal to the number of students. The sandwiches are placed in a <strong>stack</strong>. At each step:</p>
4
4
5
5
<ul>
6
6
<li>If the student at the front of the queue <strong>prefers</strong> the sandwich on the top of the stack, they will <strong>take it</strong> and leave the queue.</li>
7
-
<li>Otherwise, they will <strong>leave it</strong> and go to the queue's end.</li>
7
+
<li>Otherwise, they will <strong>leave it</strong> and go to the queue's end.</li>
8
8
</ul>
9
9
10
10
<p>This continues until none of the queue students want to take the top sandwich and are thus unable to eat.</p>
@@ -14,7 +14,8 @@
14
14
<p> </p>
15
15
<p><strongclass="example">Example 1:</strong></p>
16
16
17
-
<pre><strong>Input:</strong> students = [1,1,0,0], sandwiches = [0,1,0,1]
17
+
<pre>
18
+
<strong>Input:</strong> students = [1,1,0,0], sandwiches = [0,1,0,1]
18
19
<strong>Output:</strong> 0<strong>
19
20
Explanation:</strong>
20
21
- Front student leaves the top sandwich and returns to the end of the line making students = [1,0,0,1].
@@ -30,7 +31,8 @@ Hence all students are able to eat.
30
31
31
32
<p><strongclass="example">Example 2:</strong></p>
32
33
33
-
<pre><strong>Input:</strong> students = [1,1,1,0,0,1], sandwiches = [1,0,0,0,1,1]
34
+
<pre>
35
+
<strong>Input:</strong> students = [1,1,1,0,0,1], sandwiches = [1,0,0,0,1,1]
34
36
<strong>Output:</strong> 3
35
37
</pre>
36
38
@@ -43,4 +45,3 @@ Hence all students are able to eat.
43
45
<li><code>sandwiches[i]</code> is <code>0</code> or <code>1</code>.</li>
44
46
<li><code>students[i]</code> is <code>0</code> or <code>1</code>.</li>
0 commit comments