mirror of
https://github.com/chefyuan/algorithm-base.git
synced 2025-08-05 15:12:22 +00:00
添加Go语言题解
This commit is contained in:
@@ -135,3 +135,19 @@ class Solution {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Go Code:
|
||||
|
||||
```go
|
||||
func middleNode(head *ListNode) *ListNode {
|
||||
// 快慢指针
|
||||
fast, slow := head, head
|
||||
for fast != nil && fast.Next != nil {
|
||||
fast = fast.Next.Next
|
||||
slow = slow.Next
|
||||
}
|
||||
return slow
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user