2023每日刷题(二十三)
Leetcode—515.在每个树行中找最大值 DFS实现代码
/*** Definition for a binary tree node.* struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* };*/
/*** Note: The returned arra…
2023每日刷题(二十四)
Leetcode—102.二叉树的层序遍历 C语言BFS实现代码
/*** Definition for a binary tree node.* struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* };*/
/*** Return an array of arr…
题目链接
字符串变换
题目描述
已知有两个字串 A , B A,B A,B,及一组字串变换的规则(至多 6 6 6个规则): A 1 → B 1 A_1→B_1 A1→B1 A 2 → B 2 A_2→B_2 A2→B2 …
规则的含义为:在 A A A中的子串 A 1 A_1 A1…
题目
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has t…
2023每日刷题(二十五)
Leetcode—637.二叉树的层平均值 BFS实现代码
/*** Definition for a binary tree node.* struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* };*/
/*** Note: The returned array mu…
题目
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonal…
2023每日刷题(二十六)
Leetcode—103.二叉树的锯齿形层序遍历 BFS实现代码
/*** Definition for a binary tree node.* struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* };*/
/*** Return an array of ar…
文章目录 题目描述输入格式输出格式样例样例输入样例输出 数据范围与提示完整代码 题目描述
给出一个 N N N 个顶点 M M M 条边的无向无权图,顶点编号为 1 ∼ N 1\sim N 1∼N。问从顶点 1 1 1 开始,到其他每个点的最短路有几条。
输入格式
第一行…
2023每日刷题(二十三)
Leetcode—LCR 044.在每个树行中找最大值 DFS实现代码
/*** Definition for a binary tree node.* struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* };*/
/*** Note: The returned …