Stones are placed on the integer grid, stones[i] = [x, y], at most one per cell. You may remove a stone if there is another stone in the same row or the same column that has not been removed. Return the largest number of stones you can remove.
For [[0, 0], [0, 1], [1, 0], [1, 2], [2, 1], [2, 2]] the answer is 5.
Example 1
Input:
remove_stones([[0, 0], [0, 1], [1, 0], [1, 2], [2, 1], [2, 2]])
Output:
5
Example 2
Input:
remove_stones([[0, 0], [0, 2], [1, 1], [2, 0], [2, 2]])
Output:
3
0 <= len(stones) <= 1000000 <= x, y <= 10000No results yet
Run your code to check it against the examples, or submit to run every test.