摘要:
快速排序:递归 def quick_sort(aimlist, first, last): # 打印当前排序状态 print(aimlist) # 如果子列表只有一个元素或没有元素,直接返回 if first >= last: return # 初始化低位、高位和中间值 low = first he 阅读全文
posted @ 2024-02-22 21:49
Junior_bond
阅读(5)
评论(0)
推荐(0)
摘要:
使用迭代: class Solution: def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool: # 如果根节点为空,直接返回False if not root: return False # 使用栈来进行迭代 阅读全文
posted @ 2024-02-22 15:00
Junior_bond
阅读(8)
评论(0)
推荐(0)

浙公网安备 33010602011771号