Google SWE Phone Screen | L3

Anonymous User
1785
May 19, 2025

Q) We are given a 2D grid of characters. Count the number of non-overlapping square subgrids that meet these conditions:

  1. A square is any k x k region (with k ≥ 1) of the same character.

  2. The entire square must be made of only that character.

  3. No cell in a square should be connected to any same-letter cell outside the square (no same-letter leakage).

  4. No overlapping: Once a cell is used in a square, it cannot be reused.

I was asked this problem today but sadly was not able to code the full solution but it was fun. Is there any similar problem available on leetcode?

Comments (11)