上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页
摘要: https://leetcode-cn.com/problems/roman-to-integer/ import java.util.Map; class Solution { public int romanToInt(String s) { int res = 0; Map<Character 阅读全文
posted @ 2021-05-15 09:52 zjy4fun 阅读(44) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/integer-to-roman/ class Solution { public String intToRoman(int num) { String[] str = {"I","IV","V","IX","X","XL","L" 阅读全文
posted @ 2021-05-14 12:51 zjy4fun 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(44) 评论(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 阅读(42) 评论(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 阅读(43) 评论(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 阅读(43) 评论(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 阅读(76) 评论(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 阅读(44) 评论(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) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页