随笔分类 -  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 阅读全文
posted @ 2023-12-30 17:14 Junior_bond 阅读(2) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2023-12-29 14:59 Junior_bond 阅读(3) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2023-12-28 16:10 Junior_bond 阅读(1) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示