摘要:
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if not root or root==p or root==q:return 阅读全文
摘要:
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if p.val<root.val and q.val<root.val: re 阅读全文
摘要:
from typing import Set, Tuple class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: nums = sorted(nums) res = [] prev = None for i, 阅读全文
摘要:
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: d={} for i ,x in enumerate(nums): another_num=target-x if another_num in 阅读全文
摘要:
给你一个整数数组 nums,有一个大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 k 个数字。滑动窗口每次只向右移动一位。 返回滑动窗口中的最大值。 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/slidin 阅读全文