1 2 3 4 5 6 7 8 9 10 11 12 13
| /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func reverseList(head *ListNode) *ListNode { node := &ListNode{0,nil} for head != nil { node.Next, head, head.Next = head, head.Next, node.Next }
|