mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-10-26 07:18:56 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <p>In a string composed of <code>'L'</code>, <code>'R'</code>, and <code>'X'</code> characters, like <code>"RXXLRXRXL"</code>, a move consists of either replacing one occurrence of <code>"XL"</code> with <code>"LX"</code>, or replacing one occurrence of <code>"RX"</code> with <code>"XR"</code>. Given the starting string <code>start</code> and the ending string <code>end</code>, return <code>True</code> if and only if there exists a sequence of moves to transform one string to the other.</p>
 | |
| 
 | |
| <p> </p>
 | |
| <p><strong>Example 1:</strong></p>
 | |
| 
 | |
| <pre>
 | |
| <strong>Input:</strong> start = "RXXLRXRXL", end = "XRLXXRRLX"
 | |
| <strong>Output:</strong> true
 | |
| <strong>Explanation:</strong> We can transform start to end following these steps:
 | |
| RXXLRXRXL ->
 | |
| XRXLRXRXL ->
 | |
| XRLXRXRXL ->
 | |
| XRLXXRRXL ->
 | |
| XRLXXRRLX
 | |
| </pre>
 | |
| 
 | |
| <p><strong>Example 2:</strong></p>
 | |
| 
 | |
| <pre>
 | |
| <strong>Input:</strong> start = "X", end = "L"
 | |
| <strong>Output:</strong> false
 | |
| </pre>
 | |
| 
 | |
| <p> </p>
 | |
| <p><strong>Constraints:</strong></p>
 | |
| 
 | |
| <ul>
 | |
| 	<li><code>1 <= start.length <= 10<sup>4</sup></code></li>
 | |
| 	<li><code>start.length == end.length</code></li>
 | |
| 	<li>Both <code>start</code> and <code>end</code> will only consist of characters in <code>'L'</code>, <code>'R'</code>, and <code>'X'</code>.</li>
 | |
| </ul>
 |