Back to all patterns

DFS/BFS from Border

1 problems • Practice on LeetCode to earn credits

About This Pattern

Master the DFS/BFS from Border pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Medium (1)

Surrounded Regions

Capture all regions surrounded by 'X' by flipping 'O' to 'X'.

Key Signals:

Mark border-connected O'sDFS from edgesFlip remaining