链接:https://leetcode-cn.com/problems/recover-binary-search-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode ...
分类:
其他好文 时间:
2020-07-19 11:36:41
阅读次数:
70
链接:https://leetcode-cn.com/problems/same-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode ...
分类:
其他好文 时间:
2020-07-19 11:33:58
阅读次数:
44
今天这道题是困难难度的,二狗很努力的尝试,还是失败了。但是感觉虽然没通过全部的测试用例,思考的过程还是有很多地方挺有趣的,记录一下。 97. 交错字符串 给定三个字符串 s1, s2, s3, 验证 s3 是否是由 s1 和 s2 交错组成的。 示例 1: 输入: s1 = "aabcc", s2 ...
分类:
其他好文 时间:
2020-07-19 00:59:58
阅读次数:
95
此博客链接: https://www.cnblogs.com/ping2yingshi/p/13337999.html 搜索插入位置 题目链接:https://leetcode-cn.com/problems/search-insert-position/submissions/ 给定一个排序数组和 ...
分类:
其他好文 时间:
2020-07-19 00:56:40
阅读次数:
101
package LeetCode_1060 /** * 1060. Missing Element in Sorted Array * (Prime) * Given a sorted array A of unique numbers, find the K-th missing number s ...
分类:
其他好文 时间:
2020-07-19 00:49:27
阅读次数:
93
package LeetCode_1507 import java.lang.StringBuilder /** * 1507. Reformat Date * https://leetcode.com/problems/reformat-date/description/ * * Given a ...
分类:
其他好文 时间:
2020-07-19 00:30:33
阅读次数:
69
中序。 刚拿到题目时,第一想法是递归,但是搞错了二叉搜索树成立的条件。 我以为的条件是:左侧树为二叉搜索树,右侧树为二叉搜索树,且root.right>root>root.left,然后递归。 但是显然这不对,满足以上条件后,root.right.left可能比root要小。 先说正确的递归解法:正 ...
分类:
其他好文 时间:
2020-07-18 22:03:27
阅读次数:
71
题目链接:https://leetcode-cn.com/problems/flip-equivalent-binary-trees/ 解题思路:进行递归,当root1和root2都为空时,返回true,如果双方一个不为空,另一个为空为或双方根节点值不相等false,否则对左右子树分别不翻转判断或翻 ...
分类:
其他好文 时间:
2020-07-18 21:54:16
阅读次数:
70
编写一个函数,以字符串作为输入,反转该字符串中的元音字母。 示例 1: 输入: "hello"输出: "holle"示例 2: 输入: "leetcode"输出: "leotcede"说明:元音字母不包含字母"y"。 来源:力扣(LeetCode)链接:https://leetcode-cn.com ...
分类:
其他好文 时间:
2020-07-18 15:50:44
阅读次数:
71
给定一个非空字符串 s,最多删除一个字符。判断是否能成为回文字符串。 示例 1: 输入: "aba"输出: True示例 2: 输入: "abca"输出: True解释: 你可以删除c字符。注意: 字符串只包含从 a-z 的小写字母。字符串的最大长度是50000。 来源:力扣(LeetCode)链接 ...
分类:
其他好文 时间:
2020-07-18 15:29:26
阅读次数:
52