Description You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists ...
分类:
其他好文 时间:
2020-07-19 15:47:40
阅读次数:
73
给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 示例: 二叉树:[3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回其层次遍历结果: [ [3], [9,20], [15,7] ] class Solution( ...
分类:
其他好文 时间:
2020-07-19 13:49:57
阅读次数:
77
给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? ## 迭代 class Solution: def inorderTraversal(self, root: TreeNod ...
分类:
其他好文 时间:
2020-07-19 11:38:09
阅读次数:
55
链接: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