Minimum Rooks in a Peaceful State: Given a 2D grid representing a chessboard with rooks, determine the minimum number of rooks that can be left on the board in a peaceful state after capturing as many rooks as possible. A peaceful state is defined as a state where no two rooks can capture each other (i.e., no two rooks share the same row or column).
Leetcode 947. Most Stones Removed with Same Row or Column
Given n stones on integer coordinates where a stone can be removed if it shares a row or column with another, compute the maximum number removable. Key insight: build a graph connecting stones that share a row/column, find its connected components (via DFS/Union-Find), and the answer is n minus the number of components.
Onde essa pergunta já apareceu
Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.
Materiais associados
Nenhum anexo público associado a esta pergunta.
Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.
Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.
Continue a preparação com o banco completo
No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.