mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
批量更新数据
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<p>一个房间里有 <code>n</code> 个座位和 <code>n</code> 名学生,房间用一个数轴表示。给你一个长度为 <code>n</code> 的数组 <code>seats</code> ,其中 <code>seats[i]</code> 是第 <code>i</code> 个座位的位置。同时给你一个长度为 <code>n</code> 的数组 <code>students</code> ,其中 <code>students[j]</code> 是第 <code>j</code> 位学生的位置。</p>
|
||||
<p>一个房间里有 <code>n</code> 个 <strong>空闲</strong> 座位和 <code>n</code> 名 <strong>站着的</strong> 学生,房间用一个数轴表示。给你一个长度为 <code>n</code> 的数组 <code>seats</code> ,其中 <code>seats[i]</code> 是第 <code>i</code> 个座位的位置。同时给你一个长度为 <code>n</code> 的数组 <code>students</code> ,其中 <code>students[j]</code> 是第 <code>j</code> 位学生的位置。</p>
|
||||
|
||||
<p>你可以执行以下操作任意次:</p>
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>seats = [3,1,5], students = [2,7,4]
|
||||
<pre>
|
||||
<b>输入:</b>seats = [3,1,5], students = [2,7,4]
|
||||
<b>输出:</b>4
|
||||
<b>解释:</b>学生移动方式如下:
|
||||
- 第一位学生从位置 2 移动到位置 1 ,移动 1 次。
|
||||
@@ -23,9 +24,10 @@
|
||||
总共 1 + 2 + 1 = 4 次移动。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>seats = [4,1,5,9], students = [1,3,2,6]
|
||||
<pre>
|
||||
<b>输入:</b>seats = [4,1,5,9], students = [1,3,2,6]
|
||||
<b>输出:</b>7
|
||||
<strong>解释:</strong>学生移动方式如下:
|
||||
- 第一位学生不移动。
|
||||
@@ -35,9 +37,10 @@
|
||||
总共 0 + 1 + 3 + 3 = 7 次移动。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre><b>输入:</b>seats = [2,2,6,6], students = [1,3,2,6]
|
||||
<pre>
|
||||
<b>输入:</b>seats = [2,2,6,6], students = [1,3,2,6]
|
||||
<b>输出:</b>4
|
||||
<b>解释:</b>学生移动方式如下:
|
||||
- 第一位学生从位置 1 移动到位置 2 ,移动 1 次。
|
||||
|
Reference in New Issue
Block a user