Reddit Experience · Mar 2026

Coin Grid

1 upvote 2 replies

Interview Experience

There is an n×n grid whose each square is empty or has a coin. On each move, you can remove all coins in a row or column. What is the minimum number of moves after which the grid is empty?

Input Aft

Full Details

There is an n×n grid whose each square is empty or has a coin. On each move, you can remove all coins in a row or column. What is the minimum number of moves after which the grid is empty?

Input After this, there are n lines describing the grid. Each line has n characters: each character is either . (empty) or o (coin).

Output First print an integer k: the minimum number of moves.

Constraints * 1≤n≤1001 \le n \le 1001≤n≤100

Example Input: 3 ..o o.o ...

Output: 2

About This Question

This is a candidate experience report from a square/block interview for a swe role reported in 2026.

It covers the following topics: Matrix .

Topics