摘要:
1)倒序计算,如果结果大于标准数四倍,则超出,需要减去。空间复杂度大 class Solution: def romanToInt(self, s: str) -> int: roman_num = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, ' 阅读全文
posted @ 2021-06-10 14:50
泊鸽
阅读(82)
评论(0)
推荐(0)
摘要:
1)递归/循环,时间复杂度较高,重复计算 class Solution: def isPowerOfThree(self, n: int) -> bool: #递归 if n == 0: return False if n == 1: return True if (n / 3 )== 1 : re 阅读全文
posted @ 2021-06-10 14:34
泊鸽
阅读(70)
评论(0)
推荐(0)

浙公网安备 33010602011771号