摘要:
https://leetcode-cn.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps/submissions/ 水个分数 public class Solution { public int numWay 阅读全文
摘要:
https://leetcode-cn.com/problems/xor-queries-of-a-subarray/ 缓存一下 class Solution { public int[] xorQueries(int[] arr, int[][] queries) { int n = arr.le 阅读全文
摘要:
https://leetcode-cn.com/problems/decode-xored-permutation/ class Solution { public int[] decode(int[] encoded) { int n = encoded.length + 1; int total 阅读全文
摘要:
https://leetcode-cn.com/problems/leaf-similar-trees/ class Solution { public boolean leafSimilar(TreeNode root1, TreeNode root2) { List<Integer> list1 阅读全文
摘要:
https://leetcode-cn.com/problems/minimum-number-of-days-to-make-m-bouquets/ 通过题目可以发现,最终结果在最大值和最小值之间,另外,1 ⇐ bloomDay[i] ⇐ 10^9,可以考虑使用二分法解决这种类型的问题。 二分法对 阅读全文
摘要:
https://leetcode-cn.com/problems/find-minimum-time-to-finish-all-jobs/ 不会做,蹭个积分就走~ class Solution { /** * 最小的 工人最大用时 */ private int minId = Integer.MA 阅读全文
摘要:
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 阅读全文
摘要:
https://leetcode-cn.com/problems/decode-xored-array/ /* 异或的逆运算还是异或 */ class Solution { public int[] decode(int[] encoded, int first) { int[] res = new 阅读全文
摘要:
https://leetcode-cn.com/problems/delete-and-earn/ 开始的使用使用贪心算法,优先删除那些数量最多的元素,如果两个元素的数量相同,那就先删除大的 结果没有过 import java.util.*; class Solution { int res = 0 阅读全文
摘要:
https://leetcode-cn.com/problems/paint-house-iii/submissions/ 太特么难,不会,打个卡就走! class Solution { // 极大值 // 选择 Integer.MAX_VALUE / 2 的原因是防止整数相加溢出 static f 阅读全文