摘要: 今天是代码随想录训练营的第六十天,是最后一天,也代表这一刷结束 84.柱状图中最大的矩形 class Solution { public int largestRectangleArea(int[] heights) { int n = heights.length; Stack<Integer> 阅读全文
posted @ 2022-12-11 07:12 小猫Soda 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十九天,有经典的接雨水问题 ● 503.下一个更大元素II class Solution { public int[] nextGreaterElements(int[] nums) { if(nums == null || nums.length <= 1) { return new i 阅读全文
posted @ 2022-12-10 16:33 小猫Soda 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 今天是训练营第五十八天,是最后一天单调栈的开始 739. 每日温度 class Solution { public int[] dailyTemperatures(int[] temperatures) { int n = temperatures.length; int[] res = new i 阅读全文
posted @ 2022-12-10 16:28 小猫Soda 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十七天,也是动态规划的最后一天 647. 回文子串 class Solution { public int countSubstrings(String s) { int n = s.length(); int res = 0; boolean[][] dp = new boolean[n 阅读全文
posted @ 2022-12-10 13:12 小猫Soda 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十六天,是距离问题的动态规划 583. 两个字符串的删除操作 class Solution { public int minDistance(String word1, String word2) { int n = word1.length(); int m = word2.length 阅读全文
posted @ 2022-12-08 03:52 小猫Soda 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十五天,依旧是动态规划问题的子序列问题 392.判断子序列 class Solution { public boolean isSubsequence(String s, String t) { int n = s.length(); int m = t.length(); int[][] 阅读全文
posted @ 2022-12-08 02:53 小猫Soda 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 今天是代码随想录的第五十三天,今天依旧是子集问题 ● 1143.最长公共子序列 class Solution { public int longestCommonSubsequence(String text1, String text2) { int n = text1.length(); int 阅读全文
posted @ 2022-12-05 14:07 小猫Soda 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十二天,依旧是动态规划专题 300.最长递增子序列 class Solution { public int lengthOfLIS(int[] nums) { int[] dp = new int[nums.length]; Arrays.fill(dp, 1); for (int i = 阅读全文
posted @ 2022-12-03 16:27 小猫Soda 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十一天,继续动态规划里的股票问题 309.最佳买卖股票时机含冷冻期 class Solution { public int maxProfit(int[] prices) { int n = prices.length; int[][] dp = new int[n][2]; if(n<2 阅读全文
posted @ 2022-12-03 03:17 小猫Soda 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 今天是第五十天,还有十天一刷就结束了,今天继续是动态规划 123.买卖股票的最佳时机III class Solution { public int maxProfit(int[] prices) { int n = prices.length; int[][] dp = new int[n][5]; 阅读全文
posted @ 2022-12-01 11:57 小猫Soda 阅读(15) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示