Tap here to switch tabs
Problem
Submissions

Problem: Make a Square with the Same Color

med
30 min
Try to solve the Make a Square with the Same Color problem.

Statement

You are given a 3×33 \times 3 matrix grid containing characters 'B' and 'W', representing black and white cells respectively.

Determine if it is possible to form a 2×22 \times 2 square where all four cells have the same color by changing the color of at most 11 cell.

Return true if it is possible, or false otherwise.

Constraints:

  • grid.length =3= 3

  • grid[i].length =3= 3

  • grid[i][j] is either 'W' or 'B'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make a Square with the Same Color

med
30 min
Try to solve the Make a Square with the Same Color problem.

Statement

You are given a 3×33 \times 3 matrix grid containing characters 'B' and 'W', representing black and white cells respectively.

Determine if it is possible to form a 2×22 \times 2 square where all four cells have the same color by changing the color of at most 11 cell.

Return true if it is possible, or false otherwise.

Constraints:

  • grid.length =3= 3

  • grid[i].length =3= 3

  • grid[i][j] is either 'W' or 'B'.