FastPrepDrop and Eliminate Adjacent Pieces
Problems/Drop and Eliminate Adjacent Pieces

Drop and Eliminate Adjacent Pieces

Snowflake logoSnowflake● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version of the drop-and-eliminate task for same-color pieces is about 85% the same as the reported question. This exercise comes from a collection of interview-prep questions, not from one dated interview. We chose these rules. Pieces connect up, down, left and right. Two or more connected pieces are removed. Only one clearing happens per move. Pieces fall down. Full columns are handled in a set way. The board input has limits. We also chose what the function returns and the examples.

You are given a rectangular board. It uses 0 for an empty cell and 1 or 2 for a piece color. Rows run from top to bottom. In each column, all pieces start at the bottom with no empty cells between them.

Process the array moves from first to last. Each move is [column, color]. Drop that color into the lowest empty cell of the column. If the column is full, ignore the move.

  1. Find the group of same-color pieces connected to the new piece through shared sides. Only up, down, left, and right count; diagonals do not.
  2. If that group has at least two pieces, remove all of them at the same time. Otherwise leave the dropped piece in place.
  3. After a removal, let the remaining pieces in every column fall downward, keeping their order from top to bottom. That ends the move. Falling pieces do not cause another removal.

Return a new board showing the result after all moves. Do not change either input. Do not remove groups that are not connected to the new piece. This practice variant models drop-and-eliminate transitions; it does not stop on four-in-a-row or return a game winner.

Function

dropAndEliminate(board: int[][], moves: int[][]) → int[][]

Examples

Example 1

board = [[0,0,0],[0,0,0],[1,0,2]]moves = [[1,1]]return = [[0,0,0],[0,0,0],[0,0,2]]
board
012000010002102
→
return
012000010002002
Moved or new

The new piece touches the bottom-left piece of the same color. Both disappear; the other color stays.

Example 2

board = [[0,0],[2,0],[1,0]]moves = [[1,1]]return = [[0,0],[0,0],[2,0]]
board
01000120210
→
return
01000100220
Moved or new

The bottom pair of ones disappears. The two above the removed left piece falls to the bottom; this causes no second elimination.

Example 3

board = [[1],[2]]moves = [[0,1]]return = [[1],[2]]
board
00112
→
return
00112

The only column is full, so the move is ignored and the board stays unchanged.

Constraints

  • 1 <= rows, columns <= 10; every board row has the same length.
  • Every initial cell is 0, 1, or 2, and each column is gravity-compact.
  • 0 <= moves.length <= 200; every move has one valid column ID and color 1 or 2.
  • The output has the same dimensions and cell encoding as the input board.

More Snowflake Phone Screen questions

  • Connect Four from the Last MovePHONE SCREEN · Seen Nov 2026
  • Minimum Edits to a Perfect Binary TreePHONE SCREEN · Seen Nov 2026
  • Configurable Per-Client Token BucketsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
  • Minimum Index Distance Between Person and CakeOA · PHONE SCREEN · Seen Nov 2026
  • Minimum N-ary Tree Depth DeletionsOA · PHONE SCREEN · Seen Nov 2026
  • Sum of Binary Tree Boundary NodesOA · PHONE SCREEN · Seen Nov 2026
  • Greedy Person-Cake Matching DistancePHONE SCREEN · Seen Nov 2026
  • Tree Height After Child PromotionPHONE SCREEN · Seen Oct 2026
  • Minimum StackPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Process Minesweeper Game OperationsAmperity · PHONE SCREENAmperity interview questions
  • Minesweeper Board UpdateUber · ONSITE INTERVIEWUber interview questions
  • Minesweeper Board UpdateClay · ONSITE INTERVIEW
  • Minesweeper Board UpdateAirbyte · ONSITE INTERVIEW
  • Minimum Time to Spread Through a GridAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Grid Infection with Recovery After D DaysOpenAI · PHONE SCREENOpenAI interview questions
  • Max Area of Island Without Changing the GridFlexport · PHONE SCREENFlexport interview questions
  • Reachable Exits in an Obstacle GridWhatNot · PHONE SCREENWhatNot interview questions
  • Days Until Poisoned Plants StabilizeApple · PHONE SCREENApple interview questions
  • Apply a 2048 Board MoveGlean · PHONE SCREENGlean interview questions

Snowflake interview experiences

  • Snowflake AI Coding Interview, Experienced Hires: 3 Experiences
All Snowflake interview questionsSee Snowflake hiring insights
Saved
class Solution {
    public int[][] dropAndEliminate(int[][] board, int[][] moves) {
        // Write your solution here.
    }

}
Checking account…