Google L4 Telephone Screen

Anonymous User
747
Apr 07, 2025

Linear Chess


Given two strings, start and target. Is it possible to reach target from start given the conditions.

  1. String can contain "L", "R" or "_".
  2. L denotes a left pawn which can move only in left direction, R denotes a right pawn which can move only in right direction.
  3. Pawns can't capture or jump over other pawns.

Example :
start = "__LL_"
target = "L_L__"
output - True

Comments (8)