随笔分类 - leedcode刷题记录
摘要:class Solution: def romanToInt(self, s: str) -> int: num_convert = {'I': 1, 'V': 5, 'X':10,'L':50,'C':100,'D':500,'M':1000} s_len=len(s) count=0 for i
阅读全文
摘要:class Solution: def isPalindrome(self, x: int) -> bool: x_str=str(x) x_str_len=len(x_str) if x_str_len==1: return True count=0 for i in range(x_str_le
阅读全文
摘要:class Solution: def twoSum(self, nums, target: int): for i in range(len(nums)): if target - nums[i] in nums[i + 1:] : if i!=nums.index(target - nums[i
阅读全文