This question evaluates understanding of union-find (disjoint set) data structures and graph connectivity concepts for counting connected components in grid-based problems.
You are given an m x n grid of characters where '1' represents land and '0' represents water. An island is a group of horizontally or vertically adjacent land cells.
Return the number of islands in the grid.
Constraints/notes:
Example: Grid: 1 1 0 0 1 0 1 0 1 Output: 3