Convert Binary Number in a Linked List to Integer Solutions in GoNumber 1290Difficulty EasyAcceptance 80.6%Link LeetCodeOther languages —SolutionsGo 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 getDecimalValue(head *ListNode) int { sum := 0 for head != nil { sum = sum*2 + head.Val head = head.Next } return sum}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 getDecimalValue(head *ListNode) int { sum := 0 for head != nil { sum = sum*2 + head.Val head = head.Next } return sum }