车厢调度(python) 摘要:解题思路:注意事项:参考代码:def trainSchedule(n, order): stack = [] next_car = 1 for car in order: …… 题解列表 2023年12月17日 0 点赞 0 评论 237 浏览 评分:2.0
编写题解 2787: 有一门课不及格的学生 摘要:解题思路:注意事项:参考代码:score = list(map(int, input().split())) if min(score) < 60: if max(score) >= 60…… 题解列表 2023年12月17日 1 点赞 0 评论 234 浏览 评分:10.0
合并果子(python) 摘要:解题思路:注意事项:参考代码:import heapqdef mergeFruits(fruits): heap = [] for fruit in fruits: heap…… 题解列表 2023年12月17日 0 点赞 0 评论 170 浏览 评分:0.0
二叉树遍历(python) 摘要:解题思路:注意事项:参考代码:# 定义树节点的数据结构class TreeNode: def __init__(self, val): self.val = val …… 题解列表 2023年12月17日 0 点赞 0 评论 226 浏览 评分:8.0
求后序遍历 摘要:解题思路:注意事项:参考代码:# 定义树节点的数据结构class TreeNode: def __init__(self, val): self.val = val …… 题解列表 2023年12月17日 0 点赞 0 评论 200 浏览 评分:0.0
求后序遍历(python) 摘要:解题思路:注意事项:参考代码:def build_tree(preorder, inorder): if not preorder or not inorder: return N…… 题解列表 2023年12月17日 0 点赞 0 评论 178 浏览 评分:0.0
单词查找树(python) 摘要:解题思路:注意事项:参考代码:class TrieNode: def __init__(self): self.children = {} self.is_end_o…… 题解列表 2023年12月17日 0 点赞 0 评论 192 浏览 评分:0.0
使用滑动窗口来解决 摘要:解题思路:注意事项:参考代码:n = int(input()) a = input().split() s = [] ans = 0 # 初始化收集的雪花数量 l, r = 0, 0 # …… 题解列表 2023年12月16日 0 点赞 0 评论 205 浏览 评分:9.9
找树根和孩子(python) 摘要:解题思路:注意事项:参考代码:def find_root(tree): # 找到根节点 nodes = set(tree.keys()) children = set() fo…… 题解列表 2023年12月15日 0 点赞 0 评论 149 浏览 评分:0.0
2950: 素数回文数的个数 Python简单实现 摘要:解题思路:分别判断是否为素数和回文判断回文的思路是,将整数转换为字符串,然后判断字符串的长度,依次比较首位和末位的值是否相等即可参考代码:# 判断是否为素数 def Prime(x): f…… 题解列表 2023年12月15日 0 点赞 0 评论 192 浏览 评分:0.0