#3127

Make a Square with the Same Color

pupil · 435 · lc easy +25 · 52.9% accepted · 94 likes · top 43%

Description

Given a 3×3 grid of 'B' (black) and 'W' (white) cells, determine whether flipping at most one cell can produce a 2×2 sub-grid where all four cells share the same color. Return true if possible, false otherwise.

Code

1
2
3