Back to problems

Board Score

Algorithm · Airbnb · Medium

You are provided with a 2D grid of strings, board, where each element board[r][c] represents a tile at row r and column c. Each tile string is exactly two characters: an uppercase letter denoting the terrain, followed by a digit 0-9 indicating the number of crowns on that tile. Define an area as a maximal connected component of tiles that share the same terrain type, with tiles connected if they are adjacent orthogonally (up, down, left, right). The score of an area equals…

Checking your access…