摘要: 1005. K 次取反后最大化的数组和 public int largestSumAfterKNegations(int[] nums, int k) { if (nums.length == 1) { return k % 2 == 1 ? -nums[0] : nums[0]; } Arrays 阅读全文
posted @ 2023-01-20 16:04 维萨斯 阅读(11) 评论(0) 推荐(0)
摘要: 122. 买卖股票的最佳时机 II class Solution { public int maxProfit(int[] prices) { if (prices.length == 1) { return 0; } int interest = 0; int pre = 0, count = 0 阅读全文
posted @ 2023-01-13 15:57 维萨斯 阅读(19) 评论(0) 推荐(0)
摘要: 455. 分发饼干 public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s); int biscuit = 0, hunger = 0; for (biscuit = 0; biscuit < 阅读全文
posted @ 2023-01-13 01:18 维萨斯 阅读(12) 评论(0) 推荐(0)
摘要: 二刷见了 阅读全文
posted @ 2023-01-13 01:14 维萨斯 阅读(9) 评论(0) 推荐(0)
摘要: 491. 递增子序列 LinkedList<Integer> path = new LinkedList<>(); List<List<Integer>> result = new ArrayList<>(); public List<List<Integer>> findSubsequences( 阅读全文
posted @ 2023-01-13 01:12 维萨斯 阅读(17) 评论(0) 推荐(0)
摘要: 93. 复原 IP 地址 List<String> result = new ArrayList<String>(); StringBuilder sb = new StringBuilder(); /** * <A href="https://leetcode.cn/problems/restor 阅读全文
posted @ 2023-01-10 22:49 维萨斯 阅读(20) 评论(0) 推荐(0)
摘要: 39. 组合总和 /** * <A href="https://leetcode.cn/problems/combination-sum/description/">39. 组合总和</A> */ LinkedList<Integer> path = new LinkedList<>(); List 阅读全文
posted @ 2023-01-07 15:50 维萨斯 阅读(21) 评论(0) 推荐(0)
摘要: 216. 组合总和 III LinkedList<Integer> path = new LinkedList<>(); List<List<Integer>> result = new ArrayList<>(); /** * @param k 规模 k 个数 * @param n 目标 和为 n 阅读全文
posted @ 2023-01-06 00:09 维萨斯 阅读(24) 评论(0) 推荐(0)
摘要: 第77题. 组合 class Solution { LinkedList<Integer> path =new LinkedList<>(); List<List<Integer>> result = new ArrayList<>(); public List<List<Integer>> com 阅读全文
posted @ 2023-01-06 00:05 维萨斯 阅读(23) 评论(0) 推荐(0)
摘要: 669. 修剪二叉搜索树 public TreeNode trimBST(TreeNode root, int low, int high) { if (root == null) { return null; } if (root.val < low) { return trimBST(root. 阅读全文
posted @ 2023-01-06 00:03 维萨斯 阅读(9) 评论(0) 推荐(0)