Fork me on github
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页
摘要: https://leetcode-cn.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps/submissions/ 水个分数 public class Solution { public int numWay 阅读全文
posted @ 2021-05-13 18:07 zjy4fun 阅读(33) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/xor-queries-of-a-subarray/ 缓存一下 class Solution { public int[] xorQueries(int[] arr, int[][] queries) { int n = arr.le 阅读全文
posted @ 2021-05-12 13:36 zjy4fun 阅读(43) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/decode-xored-permutation/ class Solution { public int[] decode(int[] encoded) { int n = encoded.length + 1; int total 阅读全文
posted @ 2021-05-12 13:24 zjy4fun 阅读(41) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/leaf-similar-trees/ class Solution { public boolean leafSimilar(TreeNode root1, TreeNode root2) { List<Integer> list1 阅读全文
posted @ 2021-05-10 10:08 zjy4fun 阅读(41) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/minimum-number-of-days-to-make-m-bouquets/ 通过题目可以发现,最终结果在最大值和最小值之间,另外,1 ⇐ bloomDay[i] ⇐ 10^9,可以考虑使用二分法解决这种类型的问题。 二分法对 阅读全文
posted @ 2021-05-09 12:40 zjy4fun 阅读(42) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/find-minimum-time-to-finish-all-jobs/ 不会做,蹭个积分就走~ class Solution { /** * 最小的 工人最大用时 */ private int minId = Integer.MA 阅读全文
posted @ 2021-05-08 12:25 zjy4fun 阅读(75) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/xor-operation-in-an-array/ class Solution { public int xorOperation(int n, int start) { int res = 0; for(int i = 0; i 阅读全文
posted @ 2021-05-07 12:44 zjy4fun 阅读(41) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/decode-xored-array/ /* 异或的逆运算还是异或 */ class Solution { public int[] decode(int[] encoded, int first) { int[] res = new 阅读全文
posted @ 2021-05-06 20:05 zjy4fun 阅读(43) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/delete-and-earn/ 开始的使用使用贪心算法,优先删除那些数量最多的元素,如果两个元素的数量相同,那就先删除大的 结果没有过 import java.util.*; class Solution { int res = 0 阅读全文
posted @ 2021-05-06 19:55 zjy4fun 阅读(60) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/paint-house-iii/submissions/ 太特么难,不会,打个卡就走! class Solution { // 极大值 // 选择 Integer.MAX_VALUE / 2 的原因是防止整数相加溢出 static f 阅读全文
posted @ 2021-05-04 15:47 zjy4fun 阅读(38) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页