Reverse Linked List Solutions in GoNumber 206Difficulty EasyAcceptance 62.7%Link LeetCodeOther languages C++, JavaSolutionsGo solution by halfrost/LeetCode-Gopackage leetcode import ( "github.com/halfrost/LeetCode-Go/structures") // ListNode definetype ListNode = structures.ListNode /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func reverseList(head *ListNode) *ListNode { var behind *ListNode for head != nil { next := head.Next head.Next = behind behind = head head = next } return behind}package leetcode import ( "github.com/halfrost/LeetCode-Go/structures" ) // ListNode define type ListNode = structures.ListNode /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func reverseList(head *ListNode) *ListNode { var behind *ListNode for head != nil { next := head.Next head.Next = behind behind = head head = next } return behind }