摘要: 原题链接:https://leetcode-cn.com/problems/largest-number-at-least-twice-of-others/ 代码 1 class Solution: 2 def dominantIndex(self, nums: List[int]) -> int: 阅读全文
posted @ 2022-01-13 23:54 CaptainDragonfly 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 原题链接:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/ 相同题: LeetCode235:https://leetcode-cn.com/problems/lowest-common-ancesto 阅读全文
posted @ 2022-01-13 23:33 CaptainDragonfly 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 原题链接:https://leetcode-cn.com/problems/water-bottles/ 代码: 1 class Solution: 2 def numWaterBottles(self, numBottles: int, numExchange: int) -> int: 3 to 阅读全文
posted @ 2022-01-13 21:48 CaptainDragonfly 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 原题链接:https://leetcode-cn.com/problems/count-complete-tree-nodes/ 解题思路:树形DP 代码: 1 # Definition for a binary tree node. 2 # class TreeNode: 3 # def __in 阅读全文
posted @ 2022-01-13 21:46 CaptainDragonfly 阅读(19) 评论(0) 推荐(0) 编辑