Resolve Simultaneous Left and Right Domino Pushes

Quick Overview

Resolve Simultaneous Left and Right Domino Pushes. dominoes contains L and R for initial left/right pushes and .

Resolve Simultaneous Left and Right Domino Pushes

Company: Anduril

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Other

### Problem dominoes contains L and R for initial left/right pushes and . for upright dominoes. Every second, a falling domino pushes its upright neighbor in that direction. Simultaneous equal-time pushes from both sides cancel, leaving that domino upright. A push adds no force to an already falling or fallen domino. Return the final state. ```cpp class Solution { public: string pushDominoes(string dominoes); }; ``` ### Examples **Example 1:** ```text dominoes = "R...L" Output: "RR.LL" Explanation: The center receives opposite pushes at the same time and stays upright. ``` **Example 2:** ```text dominoes = "L..R" Output: "L..R" Explanation: The pushed endpoints fall away from the two upright dominoes. ``` ### Constraints - Domino count lies in [1,100000]. - Every character is L, R or a dot. ### Contract considerations Preserve simultaneous timing and cancellation. ```hint Read the boundary condition Can distance from the nearest effective push encode arrival time? ``` ### Boundary reminders Preserve simultaneous timing and cancellation.

Overview: Resolve Simultaneous Left and Right Domino Pushes. dominoes contains L and R for initial left/right pushes and .

Anduril logo
Anduril
Source window: 0–6 months · as of Oct 21, 2026
mediumSoftware EngineerOtherCoding & Algorithms
0
0

Problem

dominoes contains L and R for initial left/right pushes and . for upright dominoes. Every second, a falling domino pushes its upright neighbor in that direction. Simultaneous equal-time pushes from both sides cancel, leaving that domino upright. A push adds no force to an already falling or fallen domino. Return the final state.

class Solution {
public:
    string pushDominoes(string dominoes);
};

Examples

Example 1:

dominoes = "R...L"
Output: "RR.LL"
Explanation: The center receives opposite pushes at the same time and stays upright.

Example 2:

dominoes = "L..R"
Output: "L..R"
Explanation: The pushed endpoints fall away from the two upright dominoes.

Constraints

  • Domino count lies in [1,100000].
  • Every character is L, R or a dot.

Contract considerations

Preserve simultaneous timing and cancellation.

Boundary reminders

Preserve simultaneous timing and cancellation.