114.二叉树展开为链表 【LetMeFly】114.二叉树展开为链表:两种方法(简单粗暴/十分巧妙)力扣题目链接:https://leetcode.cn/problems/flatten-binary-tree-to-linked-list/ 给你二叉树的根结点 root ,请你将它展开为一个单链表: 展开后的单链表应该同样使用 TreeNode ,其中 right 子指针指向链表中下一个结点,而左 2022-07-12 #题解 #中等 #树 #LeetCode #链表 #栈 #深度优先搜索 #二叉树 #前序遍历 #巧
113.路径总和 II 【LetMeFly】113.路径总和 II:两种方法解决力扣题目链接:https://leetcode.cn/problems/path-sum-ii/ 给你二叉树的根节点 root 和一个整数目标和 targetSum ,找出所有 从根节点到叶子节点 路径总和等于给定目标和的路径。 叶子节点 是指没有子节点的节点。 示例 1: 输入:root = [5,4,8,11,null, 2022-07-12 #题解 #中等 #树 #LeetCode #回溯 #深度优先搜索 #二叉树 #BFS
1252.奇数值单元格的数目 【LetMeFly】1252.奇数值单元格的数目:低时间复杂度力扣题目链接:https://leetcode.cn/problems/cells-with-odd-values-in-a-matrix/ 给你一个 m x n 的矩阵,最开始的时候,每个单元格中的值都是 0。 另有一个二维索引数组 indices,indices[i] = [ri, ci] 指向矩阵中的某个位置,其中 ri 和 c 2022-07-12 #题解 #简单 #模拟 #数学 #数组 #LeetCode #计数 #奇偶
112.路径总和 【LetMeFly】112.路径总和:BFS + 更改节点的值力扣题目链接:https://leetcode.cn/problems/path-sum/ 给你二叉树的根节点 root 和一个表示目标和的整数 targetSum 。判断该树中是否存在 根节点到叶子节点 的路径,这条路径上所有节点值相加等于目标和 targetSum 。如果存在,返回 true ;否则,返 2022-07-11 #题解 #简单 #树 #LeetCode #深度优先搜索 #二叉树 #广度优先搜索 #BFS
111.二叉树的最小深度 【LetMeFly】111.二叉树的最小深度:DFS + 遇到叶节点更新最小深度力扣题目链接:https://leetcode.cn/problems/minimum-depth-of-binary-tree/ 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明:叶子节点是指没有子节点的节点。 示例 1: 输入:root = [3,9, 2022-07-11 #题解 #简单 #树 #LeetCode #深度优先搜索 #DFS #二叉树 #广度优先搜索 #树的深度
676.实现一个魔法字典 【LetMeFly】676.实现一个魔法字典:易实现但效率不是那么高的方法力扣题目链接:https://leetcode.cn/problems/implement-magic-dictionary/ 设计一个使用单词列表进行初始化的数据结构,单词列表中的单词 互不相同 。 如果给出一个单词,请判定能否只将这个单词中一个字母换成另一个字母,使得所形成的新单词存在于你构建的字典中。 实现 Magi 2022-07-11 #题解 #中等 #字符串 #LeetCode #哈希表 #set #字典树 #设计
AtCoder Beginner Contest 259 - D - Circumferences Time Limit: 2 sec / Memory Limit: 1024 MB Score : 400400400 points Problem StatementYou are given NNN circles on the xyxyxy-coordinate plane. For each i=1,2,…,Ni = 1, 2, \ldots, Ni=1,2,…,N, t 2022-07-09 #题解 #AtCoder #中等 #数学 #坐标 #思维 #图 #连通图
AtCoder Beginner Contest 259 - C - XX to XXX Time Limit: 2 sec / Memory Limit: 1024 MB Score : 300300300 points Problem StatementYou are given two strings SSS and TTT. Determine whether it is possible to make SSS equal TTT by performing 2022-07-09 #题解 #AtCoder #中等 #字符串 #字符串变换 #双指针
AtCoder Beginner Contest 259 - B - Counterclockwise Rotation Time Limit: 2 sec / Memory Limit: 1024 MB Score : 200200200 points Problem StatementIn an xyxyxy-coordinate plane whose xxx-axis is oriented to the right and whose yyy-axis is oriented upward 2022-07-09 #题解 #AtCoder #中等 #数学 #坐标 #旋转 #直角坐标与极坐标的转换
AtCoder Beginner Contest 259 - A - Growth Record Time Limit: 2 sec / Memory Limit: 1024 MB Score : 100100100 points Problem StatementTakahashi had his NNN-th birthday, when he was TTT centimeters tall. Additionally, we know the following fa 2022-07-09 #题解 #AtCoder #简单 #模拟 #数列