Skip to content

Commit a7808fb

Browse files
authored
002 Add Two Numbers: Remove floating point errors (qiyuangong#56)
Contributed by @dannysepler
1 parent dfa3459 commit a7808fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/002_Add_Two_Numbers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def addTwoNumbers(self, l1, l2):
5151
l2 = l2.next
5252
curr.next = ListNode(val % 10)
5353
curr = curr.next
54-
carry = val / 10
54+
carry = int(val / 10)
5555
if carry > 0:
5656
curr.next = ListNode(carry)
5757
return head.next

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy