上一页 1 2 3 4 5 6 7 ··· 25 下一页
  2022年5月2日
摘要: package leetcode; import java.util.Arrays; public class demo_279 { public int numSquares(int n) { if(n==1) {return 1;} //动态规划 int[] dp=new int[n+1]; / 阅读全文
posted @ 2022-05-02 10:31 一仟零一夜丶 阅读(32) 评论(0) 推荐(0)
  2022年4月30日
摘要: package leetcode; import java.util.HashMap; public class demo_337 { //当前节点值参与计算,所能获取的最大值 HashMap<TreeNode, Integer> t=new HashMap<TreeNode, Integer>() 阅读全文
posted @ 2022-04-30 16:24 一仟零一夜丶 阅读(26) 评论(0) 推荐(0)
摘要: package leetcode; import java.util.Arrays; public class demo_300 { public int lengthOfLIS(int[] nums) { int[] dp=new int[nums.length]; //每个位置最短递增都是1 A 阅读全文
posted @ 2022-04-30 10:46 一仟零一夜丶 阅读(18) 评论(0) 推荐(0)
  2022年4月29日
摘要: package leetcode; public class demo_437 { int count=0; public int pathSum(TreeNode root, int targetSum) { order(root, targetSum); return count; } publ 阅读全文
posted @ 2022-04-29 11:34 一仟零一夜丶 阅读(21) 评论(0) 推荐(0)
摘要: package leetcode; public class demo_309 { public int maxProfit(int[] prices) { //前i天中,最后一个操作是买入的最大收益 int[] buy=new int[prices.length]; //前i天中,最后一个操作是卖 阅读全文
posted @ 2022-04-29 10:55 一仟零一夜丶 阅读(33) 评论(0) 推荐(0)
  2022年4月28日
摘要: package leetcode; import java.util.Arrays; public class demo_322 { public int coinChange(int[] coins, int amount) { //目标为0,则对短长度为0 if(amount==0) {retu 阅读全文
posted @ 2022-04-28 16:15 一仟零一夜丶 阅读(42) 评论(0) 推荐(0)
摘要: package leetcode; public class demo_416 { public boolean canPartition(int[] nums) { int sum=0; for (int i : nums) { sum=sum+i; } //全部元素和为偶数,则不存在 if(su 阅读全文
posted @ 2022-04-28 09:48 一仟零一夜丶 阅读(17) 评论(0) 推荐(0)
  2022年4月27日
摘要: package leetcode; public class demo_338 { public int[] countBits(int n) { int[] res=new int[n+1]; for(int i=0;i<=n;i++) { if(i==0) {res[i]=0;continue; 阅读全文
posted @ 2022-04-27 16:58 一仟零一夜丶 阅读(31) 评论(0) 推荐(0)
摘要: package leetcode; import java.util.Arrays; public class demo_581 { public int findUnsortedSubarray(int[] nums) { int[] arr=new int[nums.length]; for ( 阅读全文
posted @ 2022-04-27 16:19 一仟零一夜丶 阅读(29) 评论(0) 推荐(0)
  2022年4月26日
摘要: package leetcode; public class demo_494 { public int findTargetSumWays(int[] nums, int target) { int sum=0; for(int i=0;i<nums.length;i++) { sum=sum+n 阅读全文
posted @ 2022-04-26 21:31 一仟零一夜丶 阅读(38) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 25 下一页