Problem: Making A Large Island Task: You have a grid of s and s. You can flip one to . Find the maximum island size achievable. Use DSU to track island components.
For each , check its neighbors. If flipping this connects distinct islands, sum their sizes plus one. Track the maximum. Be careful not to double-count: if two neighbors belong to the same island, count that island's size only once. Use the component leader to detect duplicates.