64. 最小路径和

摘要: 原题链接:https://leetcode-cn.com/problems/minimum-path-sum/ class Solution { // 动态规划的问题 // dp[i][j] 值表示 i,j 位置到 最右下角的最小数字和 public int minPathSum(int[][] g 阅读全文
posted @ 2020-12-26 14:52 靠自己的骨头长肉 阅读(86) 评论(0) 推荐(0) 编辑

53. 最大子序和

摘要: 原题链接:https://leetcode-cn.com/problems/maximum-subarray/ class Solution { // 动态规划 public int maxSubArray(int[] nums) { // 记录当前为位置的前一个位置已经得到的最大值 int pre 阅读全文
posted @ 2020-12-25 13:38 靠自己的骨头长肉 阅读(46) 评论(0) 推荐(0) 编辑

21. 合并两个有序链表

摘要: 原题链接:https://leetcode-cn.com/problems/merge-two-sorted-lists/ /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode 阅读全文
posted @ 2020-12-24 10:36 靠自己的骨头长肉 阅读(67) 评论(0) 推荐(0) 编辑

322. 零钱兑换

摘要: 原题链接:https://leetcode-cn.com/problems/coin-change/ class Solution { public int coinChange(int[] coins, int amount) { int[] dp = new int[amount + 1]; / 阅读全文
posted @ 2020-12-23 22:32 靠自己的骨头长肉 阅读(93) 评论(0) 推荐(0) 编辑

maven 依赖冲突解决

摘要: 现象:依赖出现现象,同时引用了同一个依赖 ,但是版本不同,发现调用的不是想要的库 解决思路: maven的引用原则有两: 1 ,最短路径原则,比如A引了B,B引了C ,C引了依赖k1.0版本 然后A直接引了k2.0版本,那A就会用k2.0版本,因为这个更近 2 如果路径长度相同的情况下,在pom 谁 阅读全文
posted @ 2020-12-23 15:18 靠自己的骨头长肉 阅读(76) 评论(0) 推荐(0) 编辑

ConcurrentHashMap 扩容实现机制 jdk8

摘要: https://blog.csdn.net/varyall/article/details/81283231 jdk8中,采用多线程扩容。整个扩容过程,通过CAS设置sizeCtl,transferIndex等变量协调多个线程进行并发扩容。 扩容相关的属性 nextTable 扩容期间,将table 阅读全文
posted @ 2020-12-21 22:19 靠自己的骨头长肉 阅读(141) 评论(0) 推荐(0) 编辑

String 对象个数

摘要: 来源:https://www.cnblogs.com/taochen-go/p/9475947.html 【内存图画的很好】 String s = new String(“hello”)和String s = “hello”; String s = new String(“hello”)会创建2(1 阅读全文
posted @ 2020-12-21 13:51 靠自己的骨头长肉 阅读(224) 评论(0) 推荐(0) 编辑

5. 最长回文子串

摘要: 原题链接:https://leetcode-cn.com/problems/longest-palindromic-substring/ class Solution { // 思路:【动态规划】 // 状态转移方程是 p[i,j] = p[i+1,j-1] && p[i] = p[j] // p[ 阅读全文
posted @ 2020-12-20 19:48 靠自己的骨头长肉 阅读(78) 评论(0) 推荐(0) 编辑

94. 二叉树的中序遍历

摘要: 题目链接:https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * T 阅读全文
posted @ 2020-12-20 14:34 靠自己的骨头长肉 阅读(144) 评论(0) 推荐(0) 编辑

3. 无重复字符的最长子串

摘要: 原题链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ class Solution { public int lengthOfLongestSubstring(String s) { 阅读全文
posted @ 2020-12-20 13:48 靠自己的骨头长肉 阅读(71) 评论(0) 推荐(0) 编辑