Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
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.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid November, 2024
Amazon
Mid-level
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).
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.