Class Solution
java.lang.Object
g0001_0100.s0019_remove_nth_node_from_end_of_list.Solution
19 - Remove Nth Node From End of List.<p>Medium</p>
<p>Given the <code>head</code> of a linked list, remove the <code>nth</code> node from the end of the list and return its head.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg" alt="" /></p>
<p><strong>Input:</strong> head = [1,2,3,4,5], n = 2</p>
<p><strong>Output:</strong> [1,2,3,5]</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> head = [1], n = 1</p>
<p><strong>Output:</strong> []</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> head = [1,2], n = 1</p>
<p><strong>Output:</strong> [1]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in the list is <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><strong>Follow up:</strong> Could you do this in one pass?</p>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
removeNthFromEnd
-