mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 03:41:41 +08:00
add leetcode problem-cn part6
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<p>给你一个链表,删除链表的倒数第 <code>n</code><em> </em>个结点,并且返回链表的头结点。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg" style="width: 542px; height: 222px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>head = [1,2,3,4,5], n = 2
|
||||
<strong>输出:</strong>[1,2,3,5]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>head = [1], n = 1
|
||||
<strong>输出:</strong>[]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>head = [1,2], n = 1
|
||||
<strong>输出:</strong>[1]
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>链表中结点的数目为 <code>sz</code></li>
|
||||
<li><code>1 <= sz <= 30</code></li>
|
||||
<li><code>0 <= Node.val <= 100</code></li>
|
||||
<li><code>1 <= n <= sz</code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>进阶:</strong>你能尝试使用一趟扫描实现吗?</p>
|
Reference in New Issue
Block a user