码迷,mamicode.com
首页 > 其他好文 > 详细

leetcode1290

时间:2019-12-15 14:15:27      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:append   ima   code   +=   none   bsp   ext   res   return   

 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

标签:append   ima   code   +=   none   bsp   ext   res   return   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!