首页 > 其他 > 详细

leetcode1290

时间:2019-12-15 14:08:37      阅读:83      评论:0      收藏:0      [点我收藏+]
 1 class Solution:
 2     def getDecimalValue(self, head: ListNode) -> int:
 3         res = 0
 4         lists = []
 5         while head != None:
 6             lists.append(head.val)
 7             head = head.next
 8         pos = 0
 9         for i in range(len(lists)-1,-1,-1):
10             res += lists[i] * (2 ** pos)
11             pos += 1
12         return res

 

leetcode1290

原文:https://www.cnblogs.com/asenyang/p/12043804.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!