2025年11月24日

摘要: 链接:121. 买卖股票的最佳时机 - 力扣(LeetCode) 维护到这天为止之前股票的最低价数组 1 class Solution(object): 2 def maxProfit(self, prices): 3 """ 4 :type prices: List[int] 5 :rtype: 阅读全文
posted @ 2025-11-24 22:36 Annetree 阅读(4) 评论(0) 推荐(0)
 
摘要: 链接:46. 全排列 - 力扣(LeetCode) 抄的官方题解 res.append(nums[:]) 这样是可以的,但是res.append(nums)这样不行。 原因是如果使用赋值操作将nums赋值给另一个变量,那么修改新变量的值会影响原始列表nums的值。例如,如果执行新列表变量new_nu 阅读全文
posted @ 2025-11-24 22:18 Annetree 阅读(5) 评论(0) 推荐(0)