摘要:
1. 题目描述 2. 代码 1 class Solution: 2 def twoSum(self, nums: 'List[int]', target: int) -> 'List[int]': 3 s = {} 4 for i in range(len(nums)): 5 n = nums[i] 阅读全文
摘要:
1. 题目描述 2. 代码 1 class MinStack: 2 def __init__(self): 3 self.stack = [] 4 self.min_stack = [] 5 6 def push(self, x: int) -> None: 7 self.stack.append( 阅读全文
摘要:
1. 题目描述 2. 代码 1 class Solution: 2 def isValid(self, s: str) -> bool: 3 n = len(s)#获取字符串的长度 4 if n == 0:#如果长度为0,则表示空串,本题认为是合法的串 5 return True 6 if n % 阅读全文
摘要:
1. 题目描述 2. 代码 1 class Solution: 2 def reverseList(self, head: ListNode) -> ListNode: 3 temp = ListNode(-1) 4 while head != None: 5 nextnode = head.nex 阅读全文
摘要:
1. 题目描述 2. 代码 1 # Definition for singly-linked list. 2 # class ListNode: 3 # def __init__(self, val=0, next=None): 4 # self.val = val 5 # self.next = 阅读全文