Skip to content

Commit e828c73

Browse files
committed
deploy: fb0d7dd
1 parent 303fb36 commit e828c73

File tree

22 files changed

+584
-235
lines changed

22 files changed

+584
-235
lines changed

contest/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80344,6 +80344,15 @@
8034480344
<nav class="md-nav" aria-label="往期竞赛">
8034580345
<ul class="md-nav__list">
8034680346

80347+
<li class="md-nav__item">
80348+
<a href="#131-2024-05-25-2230-90-2467" class="md-nav__link">
80349+
<span class="md-ellipsis">
80350+
第 131 场双周赛(2024-05-25 22:30, 90 分钟) 参赛人数 2467
80351+
</span>
80352+
</a>
80353+
80354+
</li>
80355+
8034780356
<li class="md-nav__item">
8034880357
<a href="#398-2024-05-19-1030-90-3606" class="md-nav__link">
8034980358
<span class="md-ellipsis">
@@ -84428,6 +84437,7 @@ <h2 id="_2">段位与荣誉勋章</h2>
8442884437
<h2 id="_3">赛后估分网站</h2>
8442984438
<p>如果你想在比赛结束后估算自己的积分变化,可以访问网站 <a href="https://lccn.lbao.site/">LeetCode Contest Rating Predictor</a>。</p>
8443084439
<h2 id="_4">往期竞赛</h2>
84440+
<h4 id="131-2024-05-25-2230-90-2467">第 131 场双周赛(2024-05-25 22:30, 90 分钟) 参赛人数 2467</h4>
8443184441
<h4 id="398-2024-05-19-1030-90-3606">第 398 场周赛(2024-05-19 10:30, 90 分钟) 参赛人数 3606</h4>
8443284442
<ul>
8443384443
<li><a href="../lc/3151/">3151. 特殊数组 I</a></li>

en/contest/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75744,6 +75744,15 @@
7574475744
<nav class="md-nav" aria-label="Past Contests">
7574575745
<ul class="md-nav__list">
7574675746

75747+
<li class="md-nav__item">
75748+
<a href="#biweekly-contest-131" class="md-nav__link">
75749+
<span class="md-ellipsis">
75750+
Biweekly Contest 131
75751+
</span>
75752+
</a>
75753+
75754+
</li>
75755+
7574775756
<li class="md-nav__item">
7574875757
<a href="#weekly-contest-398" class="md-nav__link">
7574975758
<span class="md-ellipsis">
@@ -79830,6 +79839,7 @@ <h2 id="contest-rating-badge">Contest Rating &amp; Badge</h2>
7983079839
<h2 id="rating-predictor">Rating Predictor</h2>
7983179840
<p>If you want to estimate your score changes after the contest ends, you can visit the website <a href="https://lccn.lbao.site/">LeetCode Contest Rating Predictor</a>.</p>
7983279841
<h2 id="past-contests">Past Contests</h2>
79842+
<h4 id="biweekly-contest-131">Biweekly Contest 131</h4>
7983379843
<h4 id="weekly-contest-398">Weekly Contest 398</h4>
7983479844
<ul>
7983579845
<li><a href="../lc/3151/">3151. Special Array I</a></li>

en/lc/2567/index.html

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75826,39 +75826,48 @@ <h1 id="2567-minimum-score-by-changing-two-elements"><a href="https://leetcode.c
7582675826
<h2 id="description">Description</h2>
7582775827
<!-- description:start -->
7582875828

75829-
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p>
75829+
<p>You are given an integer array <code>nums</code>.</p>
7583075830

7583175831
<ul>
75832-
<li>The <strong>low</strong> score of <code><font face="monospace">nums</font></code> is the minimum value of <code>|nums[i]&nbsp;- nums[j]|</code> over all <code>0 &lt;= i &lt; j &lt; nums.length</code>.</li>
75833-
<li>The <strong>high</strong> score of&nbsp;<code><font face="monospace">nums</font></code> is the maximum value of <code>|nums[i]&nbsp;- nums[j]|</code> over all <code>0 &lt;= i &lt; j &lt; nums.length</code>.</li>
75834-
<li>The <strong>score</strong> of <code>nums</code> is the sum of the <strong>high</strong> and <strong>low</strong> scores of nums.</li>
75832+
<li>The <strong>low</strong> score of <code>nums</code> is the <strong>minimum</strong> absolute difference between any two integers.</li>
75833+
<li>The <strong>high</strong> score of <code>nums</code> is the <strong>maximum</strong> absolute difference between any two integers.</li>
75834+
<li>The <strong>score</strong> of <code>nums</code> is the sum of the <strong>high</strong> and <strong>low</strong> scores.</li>
7583575835
</ul>
7583675836

75837-
<p>To minimize the score of <code>nums</code>, we can change the value of <strong>at most two</strong> elements of <code>nums</code>.</p>
75838-
75839-
<p>Return <em>the <strong>minimum</strong> possible <strong>score</strong> after changing&nbsp;the value of <strong>at most two</strong> elements o</em>f <code>nums</code>.</p>
75840-
75841-
<p>Note that <code>|x|</code> denotes the absolute value of <code>x</code>.</p>
75837+
<p>Return the <strong>minimum score</strong> after <strong>changing two elements</strong> of <code>nums</code>.</p>
7584275838

7584375839
<p>&nbsp;</p>
7584475840
<p><strong class="example">Example 1:</strong></p>
7584575841

75846-
<pre>
75847-
<strong>Input:</strong> nums = [1,4,3]
75848-
<strong>Output:</strong> 0
75849-
<strong>Explanation:</strong> Change value of nums[1] and nums[2] to 1 so that nums becomes [1,1,1]. Now, the value of |nums[i] - nums[j]| is always equal to 0, so we return 0 + 0 = 0.
75850-
</pre>
75842+
<div class="example-block">
75843+
<p><strong>Input:</strong> <span class="example-io">nums = [1,4,7,8,5]</span></p>
75844+
75845+
<p><strong>Output:</strong> <span class="example-io">3</span></p>
75846+
75847+
<p><strong>Explanation:</strong></p>
75848+
75849+
<ul>
75850+
<li>Change <code>nums[0]</code> and <code>nums[1]</code> to be 6 so that <code>nums</code> becomes [6,6,7,8,5].</li>
75851+
<li>The low score is the minimum absolute difference: |6 - 6| = 0.</li>
75852+
<li>The high score is the maximum absolute difference: |8 - 5| = 3.</li>
75853+
<li>The sum of high and low score is 3.</li>
75854+
</ul>
75855+
</div>
7585175856

7585275857
<p><strong class="example">Example 2:</strong></p>
7585375858

75854-
<pre>
75855-
<strong>Input:</strong> nums = [1,4,7,8,5]
75856-
<strong>Output:</strong> 3
75857-
<strong>Explanation:</strong> Change nums[0] and nums[1] to be 6. Now nums becomes [6,6,7,8,5].
75858-
Our low score is achieved when i = 0 and j = 1, in which case |nums[i] - nums[j]| = |6 - 6| = 0.
75859-
Our high score is achieved when i = 3 and j = 4, in which case |nums[i] - nums[j]| = |8 - 5| = 3.
75860-
The sum of our high and low score is 3, which we can prove to be minimal.
75861-
</pre>
75859+
<div class="example-block">
75860+
<p><strong>Input:</strong> <span class="example-io">nums = [1,4,3]</span></p>
75861+
75862+
<p><strong>Output:</strong> <span class="example-io">0</span></p>
75863+
75864+
<p><strong>Explanation:</strong></p>
75865+
75866+
<ul>
75867+
<li>Change <code>nums[1]</code> and <code>nums[2]</code> to 1 so that <code>nums</code> becomes [1,1,1].</li>
75868+
<li>The sum of maximum absolute difference and minimum absolute difference is 0.</li>
75869+
</ul>
75870+
</div>
7586275871

7586375872
<p>&nbsp;</p>
7586475873
<p><strong>Constraints:</strong></p>

en/lc/2612/index.html

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75835,44 +75835,59 @@ <h1 id="2612-minimum-reverse-operations"><a href="https://leetcode.com/problems/
7583575835
<h2 id="description">Description</h2>
7583675836
<!-- description:start -->
7583775837

75838-
<p>You are given an integer <code>n</code> and an integer <code>p</code> in the range <code>[<font face="monospace">0</font>, n - 1]</code>. Representing a <strong>0-indexed</strong> array <code>arr</code>&nbsp;of length <code>n</code> where all positions are set to <code>0</code>&#39;s, except position <code>p</code> which is set to <code>1</code>.</p>
75839-
75840-
<p>You are also given an integer array <code>banned</code> containing some positions from the array. For the <strong>i</strong><sup><strong>th</strong></sup> position in <code>banned</code>, <code>arr[banned[i]] = 0</code>, and <code>banned[i] != p</code>.</p>
75841-
75842-
<p>You can perform <strong>multiple</strong> operations on <code>arr</code>. In an operation, you can choose a <strong>subarray</strong> with size <code>k</code> and <strong>reverse</strong> the subarray. However, the <code>1</code> in <code>arr</code> should never go to any of the positions in <code>banned</code>. In other words, after each operation <code>arr[banned[i]]</code> <strong>remains</strong> <code>0</code>.</p>
75843-
75844-
<p><em>Return an array</em> <code>ans</code> <em>where</em><em> for each </em><code>i</code><em> from </em><code>[0, n - 1]</code>, <code>ans[i]</code> <em>is the <strong>minimum</strong> number of reverse operations needed to bring the</em> <code>1</code> <em>to position</em> <code>i</code><em> in arr</em>, <em>or</em> <code>-1</code> <em>if it is impossible</em>.</p>
75838+
<p>You are given an integer <code>n</code> and an integer <code>p</code> representing an array <code>arr</code> of length <code>n</code> where all elements are set to 0&#39;s, except position <code>p</code> which is set to 1. You are also given an integer array <code>banned</code> containing restricted positions. Perform the following operation on <code>arr</code>:</p>
7584575839

7584675840
<ul>
75847-
<li>A <strong>subarray</strong> is a contiguous <strong>non-empty</strong> sequence of elements within an array.</li>
75848-
<li>The values of <code>ans[i]</code> are independent for all <code>i</code>&#39;s.</li>
75849-
<li>The <strong>reverse </strong>of an array is an array containing the values in <strong>reverse order</strong>.</li>
75841+
<li>Reverse a <span data-keyword="subarray-nonempty"><strong>subarray</strong></span> with size <code>k</code> if the single 1 is not set to a position in <code>banned</code>.</li>
7585075842
</ul>
7585175843

75844+
<p>Return an integer array <code>answer</code> with <code>n</code> results where the <code>i<sup>th</sup></code> result is<em> </em>the <strong>minimum</strong> number of operations needed to bring the single 1 to position <code>i</code> in <code>arr</code>, or -1 if it is impossible.</p>
75845+
7585275846
<p>&nbsp;</p>
7585375847
<p><strong class="example">Example 1:</strong></p>
7585475848

75855-
<pre>
75856-
<strong>Input:</strong> n = 4, p = 0, banned = [1,2], k = 4
75857-
<strong>Output:</strong> [0,-1,-1,1]
75858-
<strong>Explanation:</strong> In this case k = 4 so there is only one possible reverse operation we can perform, which is reversing the whole array. Initially, 1<strong> </strong>is placed at position 0 so the amount of operations we need for position 0 is 0. We can never place a 1 on the banned positions, so the answer for positions 1 and 2 is -1. Finally, with one reverse operation we can bring the 1 to index 3, so the answer for position 3 is 1.
75859-
</pre>
75849+
<div class="example-block">
75850+
<p><strong>Input:</strong> <span class="example-io">n = 4, p = 0, banned = [1,2], k = 4</span></p>
75851+
75852+
<p><strong>Output:</strong> <span class="example-io">[0,-1,-1,1]</span></p>
75853+
75854+
<p><strong>Explanation:</strong></p>
75855+
75856+
<ul>
75857+
<li>Initially 1 is placed at position 0 so the number of operations we need for position 0 is 0.</li>
75858+
<li>We can never place 1 on the banned positions, so the answer for positions 1 and 2 is -1.</li>
75859+
<li>Perform the operation of size 4 to reverse the whole array.</li>
75860+
<li>After a single operation 1 is at position 3 so the answer for position 3 is 1.</li>
75861+
</ul>
75862+
</div>
7586075863

7586175864
<p><strong class="example">Example 2:</strong></p>
7586275865

75863-
<pre>
75864-
<strong>Input:</strong> n = 5, p = 0, banned = [2,4], k = 3
75865-
<strong>Output:</strong> [0,-1,-1,-1,-1]
75866-
<strong>Explanation:</strong> In this case the 1 is initially at position 0, so the answer for that position is 0. We can perform reverse operations of size 3. The 1 is currently located at position 0, so we need to reverse the subarray [0, 2] for it to leave that position, but reversing that subarray makes position 2 have a 1, which shouldn&#39;t happen. So, we can&#39;t move the 1 from position 0, making the result for all the other positions -1.
75867-
</pre>
75866+
<div class="example-block">
75867+
<p><strong>Input:</strong> <span class="example-io">n = 5, p = 0, banned = [2,4], k = 3</span></p>
75868+
75869+
<p><strong>Output:</strong> <span class="example-io">[0,-1,-1,-1,-1]</span></p>
75870+
75871+
<p><strong>Explanation:</strong></p>
75872+
75873+
<ul>
75874+
<li>Initially 1 is placed at position 0 so the number of operations we need for position 0 is 0.</li>
75875+
<li>We cannot perform the operation on the subarray positions <code>[0, 2]</code> because position 2 is in banned.</li>
75876+
<li>Because 1 cannot be set at position 2, it is impossible to set 1 at other positions in more operations.</li>
75877+
</ul>
75878+
</div>
7586875879

7586975880
<p><strong class="example">Example 3:</strong></p>
7587075881

75871-
<pre>
75872-
<strong>Input:</strong> n = 4, p = 2, banned = [0,1,3], k = 1
75873-
<strong>Output:</strong> [-1,-1,0,-1]
75874-
<strong>Explanation:</strong> In this case we can only perform reverse operations of size 1.<strong>&nbsp;</strong>So the 1 never changes its position.
75875-
</pre>
75882+
<div class="example-block">
75883+
<p><strong>Input:</strong> <span class="example-io">n = 4, p = 2, banned = [0,1,3], k = 1</span></p>
75884+
75885+
<p><strong>Output:</strong> <span class="example-io">[-1,-1,0,-1]</span></p>
75886+
75887+
<p><strong>Explanation:</strong></p>
75888+
75889+
<p>Perform operations of size 1 and 1 never changes its position.</p>
75890+
</div>
7587675891

7587775892
<p>&nbsp;</p>
7587875893
<p><strong>Constraints:</strong></p>

en/lc/2660/index.html

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -75820,58 +75820,83 @@ <h1 id="2660-determine-the-winner-of-a-bowling-game"><a href="https://leetcode.c
7582075820
<h2 id="description">Description</h2>
7582175821
<!-- description:start -->
7582275822

75823-
<p>You are given two <strong>0-indexed</strong> integer arrays <code><font face="monospace">player1</font></code> and <code>player2</code>, that represent the number of pins that player 1 and player 2 hit in a bowling game, respectively.</p>
75823+
<p>You are given two <strong>0-indexed</strong> integer arrays <code><font face="monospace">player1</font></code> and <code>player2</code>, representing the number of pins that player 1 and player 2 hit in a bowling game, respectively.</p>
7582475824

75825-
<p>The bowling game consists of <code>n</code> turns, and the number of pins in each turn is exactly <code>10</code>.</p>
75825+
<p>The bowling game consists of <code>n</code> turns, and the number of pins in each turn is exactly 10.</p>
7582675826

75827-
<p>Assume a player hit <code>x<sub>i</sub></code> pins in the <code>i<sup>th</sup></code> turn. The value of the <code>i<sup>th</sup></code> turn for the player is:</p>
75827+
<p>Assume a player hits <code>x<sub>i</sub></code> pins in the i<sup>th</sup> turn. The value of the i<sup>th</sup> turn for the player is:</p>
7582875828

7582975829
<ul>
75830-
<li><code>2x<sub>i</sub></code> if the player hit <code>10</code> pins in any of the previous two turns.</li>
75831-
<li>Otherwise, It is <code>x<sub>i</sub></code>.</li>
75830+
<li><code>2x<sub>i</sub></code> if the player hits 10 pins <b>in either (i - 1)<sup>th</sup> or (i - 2)<sup>th</sup> turn</b>.</li>
75831+
<li>Otherwise, it is <code>x<sub>i</sub></code>.</li>
7583275832
</ul>
7583375833

75834-
<p>The score of the player is the sum of the values of their <code>n</code> turns.</p>
75834+
<p>The <strong>score</strong> of the player is the sum of the values of their <code>n</code> turns.</p>
7583575835

7583675836
<p>Return</p>
7583775837

7583875838
<ul>
75839-
<li><code>1</code> <em>if the score of player 1 is more than the score of player 2,</em></li>
75840-
<li><code>2</code> <em>if the score of player 2 is more than the score of player 1, and</em></li>
75841-
<li><code>0</code> <em>in case of a draw.</em></li>
75839+
<li>1 if the score of player 1 is more than the score of player 2,</li>
75840+
<li>2 if the score of player 2 is more than the score of player 1, and</li>
75841+
<li>0 in case of a draw.</li>
7584275842
</ul>
7584375843

7584475844
<p>&nbsp;</p>
7584575845
<p><strong class="example">Example 1:</strong></p>
7584675846

75847-
<pre>
75848-
<strong>Input:</strong> player1 = [4,10,7,9], player2 = [6,5,2,3]
75849-
<strong>Output:</strong> 1
75850-
<strong>Explanation:</strong> The score of player1 is 4 + 10 + 2*7 + 2*9 = 46.
75851-
The score of player2 is 6 + 5 + 2 + 3 = 16.
75852-
Score of player1 is more than the score of player2, so, player1 is the winner, and the answer is 1.
75853-
</pre>
75847+
<div class="example-block">
75848+
<p><strong>Input:</strong> <span class="example-io">player1 = [5,10,3,2], player2 = [6,5,7,3]</span></p>
75849+
75850+
<p><strong>Output:</strong> <span class="example-io">1</span></p>
75851+
75852+
<p><strong>Explanation:</strong></p>
75853+
75854+
<p>The score of player 1 is 5 + 10 + 2*3 + 2*2 = 25.</p>
75855+
75856+
<p>The score of player 2 is 6 + 5 + 7 + 3 = 21.</p>
75857+
</div>
7585475858

7585575859
<p><strong class="example">Example 2:</strong></p>
7585675860

75857-
<pre>
75858-
<strong>Input:</strong> player1 = [3,5,7,6], player2 = [8,10,10,2]
75859-
<strong>Output:</strong> 2
75860-
<strong>Explanation:</strong> The score of player1 is 3 + 5 + 7 + 6 = 21.
75861-
The score of player2 is 8 + 10 + 2*10 + 2*2 = 42.
75862-
Score of player2 is more than the score of player1, so, player2 is the winner, and the answer is 2.
75863-
</pre>
75861+
<div class="example-block">
75862+
<p><strong>Input:</strong> <span class="example-io">player1 = [3,5,7,6], player2 = [8,10,10,2]</span></p>
75863+
75864+
<p><strong>Output:</strong> <span class="example-io">2</span></p>
75865+
75866+
<p><strong>Explanation:</strong></p>
75867+
75868+
<p>The score of player 1 is 3 + 5 + 7 + 6 = 21.</p>
75869+
75870+
<p>The score of player 2 is 8 + 10 + 2*10 + 2*2 = 42.</p>
75871+
</div>
7586475872

7586575873
<p><strong class="example">Example 3:</strong></p>
7586675874

75867-
<pre>
75868-
<strong>Input:</strong> player1 = [2,3], player2 = [4,1]
75869-
<strong>Output:</strong> 0
75870-
<strong>Explanation:</strong> The score of player1 is 2 + 3 = 5
75871-
The score of player2 is 4 + 1 = 5
75872-
The score of player1 equals to the score of player2, so, there is a draw, and the answer is 0.
75875+
<div class="example-block">
75876+
<p><strong>Input:</strong> <span class="example-io">player1 = [2,3], player2 = [4,1]</span></p>
75877+
75878+
<p><strong>Output:</strong> <span class="example-io">0</span></p>
7587375879

75874-
</pre>
75880+
<p><strong>Explanation:</strong></p>
75881+
75882+
<p>The score of player1 is 2 + 3 = 5.</p>
75883+
75884+
<p>The score of player2 is 4 + 1 = 5.</p>
75885+
</div>
75886+
75887+
<p><strong class="example">Example 4:</strong></p>
75888+
75889+
<div class="example-block">
75890+
<p><strong>Input:</strong> <span class="example-io">player1 = [1,1,1,10,10,10,10], player2 = [10,10,10,10,1,1,1]</span></p>
75891+
75892+
<p><strong>Output:</strong> <span class="example-io">1</span></p>
75893+
75894+
<p><strong>Explanation:</strong></p>
75895+
75896+
<p>The score of player1 is 1 + 1 + 1 + 10 + 2*10 + 2*10 + 2*10 = 73.</p>
75897+
75898+
<p>The score of player2 is 10 + 2*10 + 2*10 + 2*10 + 2*1 + 2*1 + 1 = 75.</p>
75899+
</div>
7587575900

7587675901
<p>&nbsp;</p>
7587775902
<p><strong>Constraints:</strong></p>

0 commit comments

Comments
 (0)