赞
踩
- class Solution:
- def convertToBase7(self, num: int) -> str:
- if num == 0:
- return '0'
- n = abs(num)
- res = ""
- while n:
- n, remainder = divmod(n, 7)
- res = str(remainder) + res
- return res if num > 0 else '-' + res
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。