摘要: class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: result = False s1_list = sorted(list(s1)) # 滑动窗口值=s1的长度 i = 0 j = i + len(s1) - 1 阅读全文
posted @ 2022-05-07 00:34 stronger_el 阅读(20) 评论(0) 推荐(0) 编辑
摘要: class Solution: def lengthOfLongestSubstring(self, s: str) -> int: if len(s) < 2: return len(s) max_length = 0 i = 0 slide_window = {} while i < len(s 阅读全文
posted @ 2022-05-05 22:49 stronger_el 阅读(25) 评论(0) 推荐(0) 编辑
摘要: # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def 阅读全文
posted @ 2022-05-05 17:12 stronger_el 阅读(18) 评论(0) 推荐(0) 编辑
摘要: # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def 阅读全文
posted @ 2022-05-05 16:19 stronger_el 阅读(44) 评论(0) 推荐(0) 编辑
摘要: class Solution: def reverseWords(self, s: str) -> str: s_arr = s.split(" ") result_arr = [] for x in s_arr: i = len(x) - 1 x_re = "" while i >= 0: x_r 阅读全文
posted @ 2022-05-05 00:08 stronger_el 阅读(11) 评论(0) 推荐(0) 编辑
摘要: class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ i = 0 j = len(s) - 1 while i 阅读全文
posted @ 2022-05-04 03:56 stronger_el 阅读(17) 评论(0) 推荐(0) 编辑
摘要: # 前后两个指针往中间靠class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: i = 0 j = len(numbers) - 1 result = [] while i < j: if num 阅读全文
posted @ 2022-05-04 03:06 stronger_el 阅读(19) 评论(0) 推荐(0) 编辑
摘要: # 暴力法 class Solution: def minimumCardPickup(self, cards: List[int]) -> int: min_card = len(cards) find = False if len(cards) == 1: return - 1 i = 0 wh 阅读全文
posted @ 2022-05-01 11:37 stronger_el 阅读(35) 评论(0) 推荐(0) 编辑
摘要: class Solution: def removeDigit(self, number: str, digit: str) -> str: max_result = 0 for i in range(0, len(number)): if number[i] == digit: if i == 0 阅读全文
posted @ 2022-05-01 11:07 stronger_el 阅读(60) 评论(0) 推荐(0) 编辑
摘要: class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ i, j = 0, 0 while j < len 阅读全文
posted @ 2022-04-30 18:06 stronger_el 阅读(15) 评论(0) 推荐(0) 编辑