链接:https://leetcode-cn.com/problems/path-sum/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode ...
分类:
其他好文 时间:
2020-07-26 19:00:19
阅读次数:
52
https://leetcode-cn.com/problems/longest-increasing-path-in-a-matrix/ 这个题是看到被人的面经来刷的。 自己想的dp实现出来是错的,思路完全乱掉了。先贴代码吧。 class Solution { public int longest ...
分类:
其他好文 时间:
2020-07-26 15:03:03
阅读次数:
349
题目链接 https://leetcode-cn.com/problems/merge-two-binary-trees/ 题解 递归解法 解法见代码注释 // Problem: LeetCode 617 // URL: https://leetcode-cn.com/problems/merge- ...
分类:
其他好文 时间:
2020-07-26 01:03:49
阅读次数:
54
题目链接 https://leetcode-cn.com/problems/path-sum/ 题解一 我自己写的 在dfs过程中要记录当前节点与根节点之间的距离,并且回溯时也需要更新该值 注意要求是叶子节点到根节点之间的距离 详细思路见代码注释 // Problem: LeetCode 112 / ...
分类:
其他好文 时间:
2020-07-26 00:50:35
阅读次数:
60
题目链接 https://leetcode-cn.com/problems/invert-binary-tree/ 题解 递归解法 // Problem: LeetCode 226 // URL: https://leetcode-cn.com/problems/invert-binary-tree ...
分类:
其他好文 时间:
2020-07-26 00:43:25
阅读次数:
55
此博客链接:https://www.cnblogs.com/ping2yingshi/p/13377164.html 题目链接:https://leetcode-cn.com/problems/implement-queue-using-stacks/ 用栈实现队列 使用栈实现队列的下列操作: pu ...
分类:
其他好文 时间:
2020-07-26 00:40:38
阅读次数:
52
给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串。 返回 s 所有可能的分割方案。 示例: 输入: "aab" 输出: [ ["aa","b"], ["a","a","b"] ] 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/p ...
分类:
其他好文 时间:
2020-07-26 00:17:17
阅读次数:
57
链接:https://leetcode-cn.com/problems/convert-sorted-list-to-binary-search-tree/ 代码 /** * Definition for singly-linked list. * struct ListNode { * int v ...
分类:
其他好文 时间:
2020-07-26 00:07:52
阅读次数:
59
链接:https://leetcode-cn.com/problems/balanced-binary-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; ...
分类:
其他好文 时间:
2020-07-26 00:05:02
阅读次数:
58
package LeetCode_283 /** * 283. Move Zeroes * https://leetcode.com/problems/move-zeroes/description/ * * Given an array nums, write a function to move ...
分类:
其他好文 时间:
2020-07-25 09:55:29
阅读次数:
69