Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit984e1fb

Browse files
committed
Create README - LeetHub
1 parent129eb75 commit984e1fb

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><ahref="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><strongclass="example">Example 1:</strong></p>
5+
6+
<divclass="example-block">
7+
<p><strong>Input:</strong> <spanclass="example-io">head = [1,2,3,4]</span></p>
8+
9+
<p><strong>Output:</strong> <spanclass="example-io">[2,1,4,3]</span></p>
10+
11+
<p><strong>Explanation:</strong></p>
12+
13+
<p><imgalt=""src="https://assets.leetcode.com/uploads/2020/10/03/swap_ex1.jpg"style="width:422px;height:222px;" /></p>
14+
</div>
15+
16+
<p><strongclass="example">Example 2:</strong></p>
17+
18+
<divclass="example-block">
19+
<p><strong>Input:</strong> <spanclass="example-io">head = []</span></p>
20+
21+
<p><strong>Output:</strong> <spanclass="example-io">[]</span></p>
22+
</div>
23+
24+
<p><strongclass="example">Example 3:</strong></p>
25+
26+
<divclass="example-block">
27+
<p><strong>Input:</strong> <spanclass="example-io">head = [1]</span></p>
28+
29+
<p><strong>Output:</strong> <spanclass="example-io">[1]</span></p>
30+
</div>
31+
32+
<p><strongclass="example">Example 4:</strong></p>
33+
34+
<divclass="example-block">
35+
<p><strong>Input:</strong> <spanclass="example-io">head = [1,2,3]</span></p>
36+
37+
<p><strong>Output:</strong> <spanclass="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)

[8]ページ先頭

©2009-2025 Movatter.jp