The Push Dominoes problem gives you a string of dominoes: 'L' falls left, 'R' falls right, '.' is standing. After all dominos fall, determine the final state. This coding problem uses a two-pointer simulation or DP approach to propagate forces from both directions. The two pointers, string, and dynamic programming interview pattern is the core.
Microsoft, Meta, Amazon, Google, and Bloomberg ask this because it requires modeling opposing forces meeting in the middle — a spatial reasoning challenge. The elegant two-pointer approach processes forces from 'R' and 'L' boundaries.
Force propagation. Assign a force to each position based on nearest 'R' (positive force, decreasing) and nearest 'L' (negative force, decreasing). Net force at each position: if positive → 'R', negative → 'L', zero → '.'. Two-pass approach: left-to-right assigns rightward forces, right-to-left assigns leftward forces. Or use segment-by-segment analysis: for each region between anchors (R...L, L...R, R...R, L...L), apply rules.
s="R..L".
Push Dominoes is a spatial force propagation problem. The cleanest implementation: iterate through segments between R and L anchors. For "R...L" segment: fill positions from both ends toward center, stopping when forces meet. For "R...R": all fall right. For "L...L": all fall left. For "L...R": all stand upright. Practice force/influence propagation problems: "candles lighting," "wave propagation," "light spreading" — they all use similar two-pass or segment analysis approaches.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Palindromic Substrings | Medium | Solve | |
| Longest Palindromic Substring | Medium | Solve | |
| Is Subsequence | Easy | Solve | |
| Longest Palindrome After Substring Concatenation I | Medium | Solve | |
| Find the Lexicographically Smallest Valid Sequence | Medium | Solve |