Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 984e1fb

Browse files
committed
Create README - LeetHub
1 parent 129eb75 commit 984e1fb

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

0024-swap-nodes-in-pairs/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<h2><a href="https://leetcode.com/problems/swap-nodes-in-pairs/">24. Swap Nodes in Pairs</a></h2><h3>Medium</h3><hr><p>Given a&nbsp;linked list, swap every two adjacent nodes and return its head. You must solve the problem without&nbsp;modifying the values in the list&#39;s nodes (i.e., only nodes themselves may be changed.)</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<div class="example-block">
7+
<p><strong>Input:</strong> <span class="example-io">head = [1,2,3,4]</span></p>
8+
9+
<p><strong>Output:</strong> <span class="example-io">[2,1,4,3]</span></p>
10+
11+
<p><strong>Explanation:</strong></p>
12+
13+
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/10/03/swap_ex1.jpg" style="width: 422px; height: 222px;" /></p>
14+
</div>
15+
16+
<p><strong class="example">Example 2:</strong></p>
17+
18+
<div class="example-block">
19+
<p><strong>Input:</strong> <span class="example-io">head = []</span></p>
20+
21+
<p><strong>Output:</strong> <span class="example-io">[]</span></p>
22+
</div>
23+
24+
<p><strong class="example">Example 3:</strong></p>
25+
26+
<div class="example-block">
27+
<p><strong>Input:</strong> <span class="example-io">head = [1]</span></p>
28+
29+
<p><strong>Output:</strong> <span class="example-io">[1]</span></p>
30+
</div>
31+
32+
<p><strong class="example">Example 4:</strong></p>
33+
34+
<div class="example-block">
35+
<p><strong>Input:</strong> <span class="example-io">head = [1,2,3]</span></p>
36+
37+
<p><strong>Output:</strong> <span class="example-io">[2,1,3]</span></p>
38+
</div>
39+
40+
<p>&nbsp;</p>
41+
<p><strong>Constraints:</strong></p>
42+
43+
<ul>
44+
<li>The number of nodes in the&nbsp;list&nbsp;is in the range <code>[0, 100]</code>.</li>
45+
<li><code>0 &lt;= Node.val &lt;= 100</code></li>
46+
</ul>

0 commit comments

Comments
 (0)