摘要:
class Solution { public int maxDistance(int[][] grid) { // 思路:宽度优先遍历。 // 第一层有一个或者多个。单源+多源。 // 遍历到每一层的时候,看当前层有多少个数,然后就操作多少次。 int m = grid.length; int n 阅读全文
摘要:
import java.io.*; import java.util.*; public class Main { public static int n = 100001; public static int m = 100001; public static ArrayList<ArrayLis 阅读全文
摘要:
import java.util.ArrayList; import java.util.Arrays; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static int n = 11; public static 阅读全文
摘要:
class Solution { public void solve(char[][] board) { // 思路:从边缘入手,遇到O.就渲染为'F',递归渲染其他O; // 再遍历 .遇到的O就可以都渲染为X. // 最后更新F为O; int m = board.length; int n = 阅读全文
摘要:
import java.util.HashMap; class Solution { public static HashMap<Integer, Integer> row = new HashMap<>(); public static HashMap<Integer, Integer> col 阅读全文
摘要:
class Solution { public static int MAXN = 90001; public static int[] f = new int[MAXN]; public static int n = 0; public static int union_count = 0; pu 阅读全文