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: solution/2500-2599/2532.Time to Cross a Bridge/README_EN.md
+1
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ tags:
43
43
<ul>
44
44
<li>Only one worker can use the bridge at a time.</li>
45
45
<li>When the bridge is unused prioritize the <strong>least efficient</strong> worker on the right side to cross. If there are no workers on the right side, prioritize the <strong>least efficient</strong> worker on the left side to cross.</li>
46
+
<li>If enough workers have already been dispatched from the left side to pick up all the remaining boxes, <strong>no more</strong> workers will be sent from the left side.</li>
46
47
</ul>
47
48
48
49
<p>Return the <strong>elapsed minutes</strong> at which the last box reaches the <strong>left side of the bridge</strong>.</p>
Copy file name to clipboardexpand all lines: solution/3000-3099/3038.Maximum Number of Operations With the Same Score I/README_EN.md
+38-20
Original file line number
Diff line number
Diff line change
@@ -19,38 +19,56 @@ tags:
19
19
20
20
<!-- description:start -->
21
21
22
-
<p>Given an array of integers called <code>nums</code>, you can perform the following operation while <code>nums</code> contains <strong>at least</strong> <code>2</code> elements:</p>
22
+
<p>You are given an array of integers <code>nums</code>. Consider the following operation:</p>
23
23
24
24
<ul>
25
-
<li>Choose the first two elements of <code>nums</code> and delete them.</li>
25
+
<li>Delete the first two elements <code>nums</code> and define the <em>score</em> of the operation as the sum of these two elements.</li>
26
26
</ul>
27
27
28
-
<p>The<strong> score</strong> of the operation is the sum of the deleted elements.</p>
28
+
<p>You can perform this operation until <code>nums</code> contains fewer than two elements. Additionally, the <strong>same</strong> <em>score</em> must be achieved in <strong>all</strong> operations.</p>
29
29
30
-
<p>Your task is to find the <strong>maximum</strong> number of operations that can be performed, such that <strong>all operations have the same score</strong>.</p>
31
-
32
-
<p>Return <em>the <strong>maximum</strong> number of operations possible that satisfy the condition mentioned above</em>.</p>
30
+
<p>Return the <strong>maximum</strong> number of operations you can perform.</p>
33
31
34
32
<p> </p>
35
33
<p><strongclass="example">Example 1:</strong></p>
36
34
37
-
<pre>
38
-
<strong>Input:</strong> nums = [3,2,1,4,5]
39
-
<strong>Output:</strong> 2
40
-
<strong>Explanation:</strong> We perform the following operations:
41
-
- Delete the first two elements, with score 3 + 2 = 5, nums = [1,4,5].
42
-
- Delete the first two elements, with score 1 + 4 = 5, nums = [5].
43
-
We are unable to perform any more operations as nums contain only 1 element.</pre>
<li>We can perform the first operation with the score <code>3 + 2 = 5</code>. After this operation, <code>nums = [1,4,5]</code>.</li>
44
+
<li>We can perform the second operation as its score is <code>4 + 1 = 5</code>, the same as the previous operation. After this operation, <code>nums = [5]</code>.</li>
45
+
<li>As there are fewer than two elements, we can't perform more operations.</li>
46
+
</ul>
47
+
</div>
44
48
45
49
<p><strongclass="example">Example 2:</strong></p>
46
50
47
-
<pre>
48
-
<strong>Input:</strong> nums = [3,2,6,1,4]
49
-
<strong>Output:</strong> 1
50
-
<strong>Explanation:</strong> We perform the following operations:
51
-
- Delete the first two elements, with score 3 + 2 = 5, nums = [6,1,4].
52
-
We are unable to perform any more operations as the score of the next operation isn't the same as the previous one.
<li>We can perform the first operation with the score <code>1 + 5 = 6</code>. After this operation, <code>nums = [3,3,4,1,3,2,2,3]</code>.</li>
60
+
<li>We can perform the second operation as its score is <code>3 + 3 = 6</code>, the same as the previous operation. After this operation, <code>nums = [4,1,3,2,2,3]</code>.</li>
61
+
<li>We cannot perform the next operation as its score is <code>4 + 1 = 5</code>, which is different from the previous scores.</li>
0 commit comments