2020年6月9日

罗马数字转整型

摘要: # 将罗马数字转换成整型# class Solution:# def romanToInt(self, s):# d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}# num = 0# for i in rang 阅读全文

posted @ 2020-06-09 13:42 阿虾 阅读(174) 评论(0) 推荐(0) 编辑

判断回文数

摘要: class Solution: def isPalindrome(self, x): if str(x).startswith('-'): return False else: a = str(x) b = a[::-1] if a == b: return True else: return Fa 阅读全文

posted @ 2020-06-09 13:01 阿虾 阅读(120) 评论(0) 推荐(0) 编辑

导航