update
This commit is contained in:
parent
f86bd9c3d6
commit
e5540ed7ff
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue