摘要:
Thread中断机制interrupt 一、中断线程 线程的thread.interrupt()方法是中断线程,将会设置该线程的中断状态位,即设置为true,标记线程处于中断状态,但不会终止线程,线程还会继续执行。中断的结果线程是死亡,还是等待新的任务或是继续运行至下一步,取决于这个程序本身。线程会 阅读全文
摘要:
class Solution: def bestSeqAtIndex(self, height: List[int], weight: List[int]) -> int: n = len(height) persons = [[height[i],weight[i]] for i in range 阅读全文
摘要:
class Node: def __init__(self,key,value,next=None): self.key = key self.value = value self.next = next class MyHashMap: def __init__(self): self.array 阅读全文
摘要:
class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: n = len(prices) if k >= n // 2: res = 0 for i in range(1, n): if prices[i] > pr 阅读全文
摘要:
class Solution: def maxProfit(self, prices: List[int]) -> int: n = len(prices) dp = [[[0, 0] for i in range(3)] for j in range(n)] for j in range(1, 3 阅读全文
摘要:
class Solution: def maxProfit(self, prices: List[int]) -> int: n = len(prices) count = 0 for i in range(1,n): if prices[i]>prices[i-1]: count += price 阅读全文
摘要:
class Solution: def maxProfit(self, prices: List[int]) -> int: max_profit = 0 min_price = prices[0] n = len(prices) for i in range(n): min_price = min 阅读全文