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

Commitfbf12aa

Browse files
Create 876. Middle of the Linked List.java
1 parented259ed commitfbf12aa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//fast and slow pointer
2+
classSolution {
3+
publicListNodemiddleNode(ListNodehead) {
4+
ListNodeslow =head;
5+
ListNodefast =head;
6+
while (fast!=null &&fast.next!=null) {
7+
fast =fast.next.next;
8+
slow =slow.next;
9+
}
10+
returnslow;
11+
}
12+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp