Problem 2337 · Medium

Move Pieces to Obtain a String

Match the pieces of both strings in order with two pointers; an L may only move left and an R may only move right.

Open the interactive visualisation