mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-12 02:41:42 +08:00
批量更新数据
This commit is contained in:
@@ -19,29 +19,33 @@
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
<img alt="" src="https://pic.leetcode.cn/1723688159-qYjpWT-image.png" style="width: 402px; height: 289px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [2,-1,1,2,2]
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>存在循环,按下标 0 -> 2 -> 3 -> 0 。循环长度为 3 。
|
||||
<strong>解释:</strong>图片展示了节点间如何连接。白色节点向前跳跃,而红色节点向后跳跃。
|
||||
我们可以看到存在循环,按下标 0 -> 2 -> 3 -> 0 --> ...,并且其中的所有节点都是白色(以相同方向跳跃)。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
<img alt="" src="https://pic.leetcode.cn/1723688183-lRSkjp-image.png" style="width: 402px; height: 390px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [-1,2]
|
||||
<strong>输入:</strong>nums = [-1,-2,-3,-4,-5,6]
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>按下标 1 -> 1 -> 1 ... 的运动无法构成循环,因为循环的长度为 1 。根据定义,循环的长度必须大于 1 。
|
||||
<strong>解释:</strong>图片展示了节点间如何连接。白色节点向前跳跃,而红色节点向后跳跃。
|
||||
唯一的循环长度为 1,所以返回 false。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
<img alt="" src="https://pic.leetcode.cn/1723688199-nhaMuF-image.png" style="width: 497px; height: 242px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [-2,1,-1,-2,-2]
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>按下标 1 -> 2 -> 1 -> ... 的运动无法构成循环,因为 nums[1] 是正数,而 nums[2] 是负数。
|
||||
所有 nums[seq[j]] 应当不是全正就是全负。</pre>
|
||||
<strong>输入:</strong>nums = [1,-1,5,1,4]
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>图片展示了节点间如何连接。白色节点向前跳跃,而红色节点向后跳跃。
|
||||
我们可以看到存在循环,按下标 0 --> 1 --> 0 --> ...,当它的大小大于 1 时,它有一个向前跳的节点和一个向后跳的节点,所以 <strong>它不是一个循环</strong>。
|
||||
我们可以看到存在循环,按下标 3 --> 4 --> 3 --> ...,并且其中的所有节点都是白色(以相同方向跳跃)。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
|
Reference in New Issue
Block a user