02 2023 档案
摘要:2331. 计算布尔二叉树的值 题解: DFS 深搜 class Solution { public boolean evaluateTree(TreeNode root) { switch (root.val) { case 0 : return false; case 1 : return tr
阅读全文
摘要:1129. 颜色交替的最短路径 题解: BFS 宽搜 用宽搜求最短路 public int[] shortestAlternatingPaths(int n, int[][] redEdges, int[][] blueEdges) { int[] res = new int[n]; res[0]
阅读全文
摘要:2325. 解密消息 题解 模拟 public String decodeMessage(String key, String message) { // 存映射 Map<Character, Character> map = new HashMap<>(); int i = 0; for (cha
阅读全文