PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Maximize coins collected by 3-step pieces

Last updated: Mar 29, 2026

Quick Overview

This question evaluates modeling and optimization of discrete state-space transitions under movement constraints, testing combinatorial reasoning, reachability, and resource-maximization competencies.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Maximize coins collected by 3-step pieces

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a 1D board of length **N**. Each cell is in one of three states: - **Empty** - **Piece** (a movable token) - **Coin** (collectible) In one move, you may choose **any one piece** and move it **exactly 3 cells to the right** (from index `i` to `i+3`). The move rules are: 1. If the destination cell is **empty**, the piece moves there. 2. If the destination cell contains a **coin**, the piece moves there and you **collect** that coin (the coin is removed). 3. Pieces **cannot overlap**: a move is **not allowed** if the destination cell already contains another piece. 4. The piece may “jump over” intervening cells; only the destination cell matters. 5. A move is not allowed if `i+3` is outside the board. You may perform moves in any order, for as many turns as you like, until **no piece can legally move**. Return the **maximum number of coins** you can collect. ### Input - A representation of the board (e.g., a string/array of length `N`) containing exactly one of `{empty, piece, coin}` per cell. ### Output - An integer: the maximum number of coins collectible. ### Notes / Clarifications - Multiple pieces may exist. - Coins are collected at most once (they disappear after collection). - The result depends on the order in which you choose moves.

Quick Answer: This question evaluates modeling and optimization of discrete state-space transitions under movement constraints, testing combinatorial reasoning, reachability, and resource-maximization competencies.

Related Interview Questions

  • Solve Flower Placement and Directory Deletion - Google (medium)
  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Implement Checksums and Feature Rollout Evaluation - Google (medium)
Google logo
Google
Sep 5, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
2
0

You are given a 1D board of length N. Each cell is in one of three states:

  • Empty
  • Piece (a movable token)
  • Coin (collectible)

In one move, you may choose any one piece and move it exactly 3 cells to the right (from index i to i+3). The move rules are:

  1. If the destination cell is empty , the piece moves there.
  2. If the destination cell contains a coin , the piece moves there and you collect that coin (the coin is removed).
  3. Pieces cannot overlap : a move is not allowed if the destination cell already contains another piece.
  4. The piece may “jump over” intervening cells; only the destination cell matters.
  5. A move is not allowed if i+3 is outside the board.

You may perform moves in any order, for as many turns as you like, until no piece can legally move.

Return the maximum number of coins you can collect.

Input

  • A representation of the board (e.g., a string/array of length N ) containing exactly one of {empty, piece, coin} per cell.

Output

  • An integer: the maximum number of coins collectible.

Notes / Clarifications

  • Multiple pieces may exist.
  • Coins are collected at most once (they disappear after collection).
  • The result depends on the order in which you choose moves.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google 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.