This commit is contained in:
ZennDev1337 2024-03-26 09:45:11 +01:00
parent f86bd9c3d6
commit e5540ed7ff

View file

@ -33,14 +33,14 @@ func (l *ListNode) Get(index int) (int, error) {
}
func (l *ListNode) GetNr() int {
res := 0
multiplyer := 1
multiplier := 1
current := l
for current.Next != nil {
res = res + (current.Val * multiplyer)
multiplyer = multiplyer * 10
res = res + (current.Val * multiplier)
multiplier = multiplier * 10
current = current.Next
}
res = res + (current.Val * multiplyer)
res = res + (current.Val * multiplier)
return res
}
func (l *ListNode) Length() int {