题目描述链接:https://leetcode-cn.com/problems/longest-common-subsequence/ 解题思路:经典的LCS最长公共子序列问题:使用动态规划进行解题, (1)状态标识dp[i][j]标识text1[0]到text1[i-1]与text2[0]到tex ...
分类:
其他好文 时间:
2020-07-29 21:54:41
阅读次数:
78
本题 题目链接 题目描述 我的题解 二分法 思路分析 排序数组中的搜索问题,首先想到二分法 当nums[center] > center 时,缺少的数在左区间 当nums[center] = center 时,缺少的数在右区间 代码如下 public int missingNumber(int[] ...
分类:
其他好文 时间:
2020-07-29 21:22:09
阅读次数:
74
package LeetCode_636 import java.util.* /** * 636. Exclusive Time of Functions * https://leetcode.com/problems/exclusive-time-of-functions/description ...
分类:
其他好文 时间:
2020-07-29 10:01:26
阅读次数:
59
题目链接 https://leetcode-cn.com/problems/binary-tree-maximum-path-sum/ 题解 递归解法 路径:一条从树中任意节点出发,达到任意节点的序列。该路径至少包含一个节点,且不一定经过根节点。 这道题和LeetCode687最长同值路径和Leet ...
分类:
其他好文 时间:
2020-07-27 23:35:37
阅读次数:
74
[编程题] lc 169. 多数元素 题目 输入输出 Java代码(方法1:借用哈希表计数) //方法1:借助哈希 public int majorityElement(int[] nums) { HashMap<Integer,Integer> map = new HashMap<>(); for ...
分类:
其他好文 时间:
2020-07-27 09:38:33
阅读次数:
51
给定一个平衡括号字符串 S,按下述规则计算该字符串的分数: () 得 1 分。 AB 得 A + B 分,其中 A 和 B 是平衡括号字符串。 (A) 得 2 * A 分,其中 A 是平衡括号字符串。 示例 1: 输入: "()" 输出: 1 示例 2: 输入: "(())" 输出: 2 示例 3: ...
分类:
其他好文 时间:
2020-07-26 23:24:27
阅读次数:
113
题目链接 https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/ 题解一 递归解法 我写的 说明详见注释 // Problem: LeetCode 111 // URL: https://leetcode-cn.com/probl ...
分类:
其他好文 时间:
2020-07-26 19:32:58
阅读次数:
60
eclipse中选择->window->show view->other弹出对话框中选择general下面找problems然后双击,即可查看红叉原因. 我的项目报 :An error occurred while filtering resources 解决方案: 1.右键项目 2找到maven ...
分类:
系统相关 时间:
2020-07-26 19:12:44
阅读次数:
88
链接:https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNod ...
分类:
其他好文 时间:
2020-07-26 19:03:29
阅读次数:
62
题目描述 https://leetcode-cn.com/problems/subtree-of-another-tree/ 题解 我写的 两层DFS、双重DFS 其它题解一般也是这个思路 // Problem: LeetCode 572 // URL: https://leetcode-cn.co ...
分类:
其他好文 时间:
2020-07-26 19:01:52
阅读次数:
62