-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ecd1e3
commit e59fda7
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<h2><a href="https://leetcode.com/problems/middle-of-the-linked-list/">876. Middle of the Linked List</a></h2><h3>Easy</h3><hr><div><p>Given the <code>head</code> of a singly linked list, return <em>the middle node of the linked list</em>.</p> | ||
|
||
<p>If there are two middle nodes, return <strong>the second middle</strong> node.</p> | ||
|
||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
<img alt="" src="https://assets.leetcode.com/uploads/2021/07/23/lc-midlist1.jpg" style="width: 544px; height: 65px;"> | ||
<pre><strong>Input:</strong> head = [1,2,3,4,5] | ||
<strong>Output:</strong> [3,4,5] | ||
<strong>Explanation:</strong> The middle node of the list is node 3. | ||
</pre> | ||
|
||
<p><strong>Example 2:</strong></p> | ||
<img alt="" src="https://assets.leetcode.com/uploads/2021/07/23/lc-midlist2.jpg" style="width: 664px; height: 65px;"> | ||
<pre><strong>Input:</strong> head = [1,2,3,4,5,6] | ||
<strong>Output:</strong> [4,5,6] | ||
<strong>Explanation:</strong> Since the list has two middle nodes with values 3 and 4, we return the second one. | ||
</pre> | ||
|
||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li>The number of nodes in the list is in the range <code>[1, 100]</code>.</li> | ||
<li><code>1 <= Node.val <= 100</code></li> | ||
</ul> | ||
</div> |