Most Stones Removed with Same Row or Column

Medium · Graphs · about 25 minutes

Asked at Google, Amazon, Snowflake, Snap, Bloomberg, Discord, Twitch.

Stones are placed at distinct integer points stones[i] = [x, y]. A stone can be removed if another remaining stone shares its row or column. Return the maximum number of stones that can be removed.

Related guides