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 {
|
func (l *ListNode) GetNr() int {
|
||||||
res := 0
|
res := 0
|
||||||
multiplyer := 1
|
multiplier := 1
|
||||||
current := l
|
current := l
|
||||||
for current.Next != nil {
|
for current.Next != nil {
|
||||||
res = res + (current.Val * multiplyer)
|
res = res + (current.Val * multiplier)
|
||||||
multiplyer = multiplyer * 10
|
multiplier = multiplier * 10
|
||||||
current = current.Next
|
current = current.Next
|
||||||
}
|
}
|
||||||
res = res + (current.Val * multiplyer)
|
res = res + (current.Val * multiplier)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
func (l *ListNode) Length() int {
|
func (l *ListNode) Length() int {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue