777. Swap Adjacent in LR String
In a string composed of 'L'
, 'R'
, and 'X'
characters, like "RXXLRXRXL"
, a move consists of either replacing one occurrence of "XL"
with "LX"
, or replacing one occurrence of "RX"
with "XR"
. Given the starting string start
and the ending string end
, return True
if and only if there exists a sequence of moves to transform one string to the other.
Example:
Note:
1 <= len(start) = len(end) <= 10000
.Both start and end will only consist of characters in
{'L', 'R', 'X'}
.
Last updated
Was this helpful?