摘要: #导入库 import numpy as np import pandas as pd import random from datetime import datetime from matplotlib import pyplot as plt import seaborn as sns fro 阅读全文
posted @ 2022-07-14 18:44 是冰美式诶 阅读(117) 评论(0) 推荐(0)
摘要: #笑话来咯 import math class Solution: def divide(self, dividend: int, divisor: int) -> int: ans = dividend / divisor if dividend / divisor < 2147483648 el 阅读全文
posted @ 2022-07-14 18:12 是冰美式诶 阅读(30) 评论(0) 推荐(0)
摘要: # 有点问题,解决了数组越界后但还是发生错误,待解决 class Solution: def strStr(self, haystack: str, needle: str) -> int: if not needle: return 0 if len(needle)>len(haystack): 阅读全文
posted @ 2022-07-14 16:32 是冰美式诶 阅读(23) 评论(0) 推荐(0)
摘要: #还是双指针,与上一道题相似 class Solution: def removeElement(self, nums: List[int], val: int) -> int: fast,slow = 0,0 while fast<len(nums): if nums[fast]!=val: nu 阅读全文
posted @ 2022-07-14 15:44 是冰美式诶 阅读(22) 评论(0) 推荐(0)
摘要: #遍历一遍,快慢指针 class Solution: def removeDuplicates(self, nums: List[int]) -> int: pre,cur=0,1 while cur<len(nums): if nums[pre]==nums[cur]: nums.pop(cur) 阅读全文
posted @ 2022-07-14 15:29 是冰美式诶 阅读(30) 评论(0) 推荐(0)