{"description":"UnionFind island count direction https://leetcode.com/problems/number-of-islands/ class Solution { public int numIslands(char[][] grid) { int rows = grid.length; int cols = grid[0].length; int countIslands = 0; int[][] directions = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; UnionFind uf = new UnionFind(row\u2026","author_name":"cindychen0204","blog_title":"Cindy's Blog","version":"1.0","provider_name":"Hatena Blog","height":"190","title":"LeetCode 200. Number of Islands","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcindychen0204.hatenablog.com%2Fentry%2F2022%2F10%2F11%2FLeetCode_200._Number_of_Islands\" title=\"LeetCode 200. Number of Islands - Cindy&#39;s Blog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://cindychen0204.hatenablog.com/entry/2022/10/11/LeetCode_200._Number_of_Islands","published":"2022-10-11 23:22:47","width":"100%","categories":[],"type":"rich","image_url":null,"provider_url":"https://hatena.blog","blog_url":"https://cindychen0204.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/cindychen0204/"}