[leet_code] 1290. Convert Binary Number in a Linked List to Integer with python3
28 Dec 2019
Reading time ~1 minute
문제 : https://leetcode.com/contest/weekly-contest-167/problems/convert-binary-number-in-a-linked-list-to-integer/
def getDecimalValue(self, head: ListNode) -> int:
ans = 0
while head != None:
ans = 2*ans + head.val
head = head.next
return ans