Most Stones Removed with Same Row or Column
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
There are n stones on a 2D grid, each at a distinct integer coordinate stones[i] = [x, y]. A stone may be removed if at least one **other** stone that has not been removed yet shares its row (x) or its column (y).
Removals happen one at a time, and the order is up to you. Return the largest number of stones that can be removed.
Examples
Constraints
- 1 <= stones.length <= 1000
- 0 <= x, y <= 10^4
- No two stones share the same coordinate
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.