Push Dominoes
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A row of dominoes stands upright, described by the string dominoes: 'L' is a domino just pushed to the left, 'R' one just pushed to the right, and '.' one still standing.
Every second, each falling domino pushes its upright neighbour in the direction it is falling. An upright domino pushed from both sides in the same second stays upright. Falling or fallen dominoes put no force on dominoes that are already falling or fallen.
Return a string describing the final state once nothing changes.
Examples
Constraints
- 1 <= dominoes.length <= 10^5
- `dominoes[i]` is 'L', 'R' or '.'.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.