PracHub
QuestionsPremiumLearningGuidesInterview PrepCoaches
|Home/Coding & Algorithms/Airbnb

Compute board-game score from regions

Last updated: Apr 19, 2026

Quick Overview

This question evaluates grid traversal and connected-component identification skills along with region-based aggregation (counting cells and summing crowns) in the Coding & Algorithms category.

  • medium
  • Airbnb
  • Coding & Algorithms
  • Software Engineer

Compute board-game score from regions

Company: Airbnb

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a 2D board for a board game. Each cell is encoded like `G1` or `W0`: - The first character is the **terrain/area type** (e.g., `G`, `W`, `S`). - The digit is the number of **crowns** in that cell (0–9). Two cells belong to the same **area/region** if they have the same terrain type and are connected by 4-directional adjacency (up/down/left/right). For each region: \[ \text{regionScore} = (\#\text{cells in region}) \times (\text{sum of crowns in region}) \] Return the **total score** across all regions. ### Example Board (rows): 1. `G1, G2, W0, W1, S1` 2. `G2, G3, W0, W1, S1` 3. `S2, S3, S1, G1, S1` 4. `G1, G2, W0, W1, S1` 5. `G1, G2, W0, W1, S1` Compute the total score for this board. ### Additional requirement Write a small set of self-contained test cases that cover edge cases (e.g., all same terrain, all crowns 0, single-cell regions, multiple disjoint regions of same terrain type).

Quick Answer: This question evaluates grid traversal and connected-component identification skills along with region-based aggregation (counting cells and summing crowns) in the Coding & Algorithms category.

Related Interview Questions

  • Find Optimal Property Combination - Airbnb (medium)
  • Determine Exact Layover Booking - Airbnb (medium)
  • Solve Linked-List and Iterator Problems - Airbnb
  • Implement Text Layout and Query Parsing - Airbnb (easy)
  • Parse Query Parameters Into a Map - Airbnb (medium)
Airbnb logo
Airbnb
Feb 12, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
43
0
Coding Console
Loading...

You are given a 2D board for a board game. Each cell is encoded like G1 or W0:

  • The first character is the terrain/area type (e.g., G , W , S ).
  • The digit is the number of crowns in that cell (0–9).

Two cells belong to the same area/region if they have the same terrain type and are connected by 4-directional adjacency (up/down/left/right).

For each region:

regionScore=(#cells in region)×(sum of crowns in region)\text{regionScore} = (\#\text{cells in region}) \times (\text{sum of crowns in region})regionScore=(#cells in region)×(sum of crowns in region)

Return the total score across all regions.

Example

Board (rows):

  1. G1, G2, W0, W1, S1
  2. G2, G3, W0, W1, S1
  3. S2, S3, S1, G1, S1
  4. G1, G2, W0, W1, S1
  5. G1, G2, W0, W1, S1

Compute the total score for this board.

Additional requirement

Write a small set of self-contained test cases that cover edge cases (e.g., all same terrain, all crowns 0, single-cell regions, multiple disjoint regions of same terrain type).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Airbnb•More Software Engineer•Airbnb Software Engineer•Airbnb Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.