mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定两个字符串 <code>s</code> 和 <code>t</code> ,判断它们是否是同构的。</p>
 | 
						||
 | 
						||
<p>如果 <code>s</code> 中的字符可以按某种映射关系替换得到 <code>t</code> ,那么这两个字符串是同构的。</p>
 | 
						||
 | 
						||
<p>每个出现的字符都应当映射到另一个字符,同时不改变字符的顺序。不同字符不能映射到同一个字符上,相同字符只能映射到同一个字符上,字符可以映射到自己本身。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>s = <code>"egg"</code>, t = <code>"add"</code>
 | 
						||
<strong>输出:</strong>true
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>s = <code>"foo"</code>, t = <code>"bar"</code>
 | 
						||
<strong>输出:</strong>false</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>s = <code>"paper"</code>, t = <code>"title"</code>
 | 
						||
<strong>输出:</strong>true</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<p><meta charset="UTF-8" /></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= s.length <= 5 * 10<sup>4</sup></code></li>
 | 
						||
	<li><code>t.length == s.length</code></li>
 | 
						||
	<li><code>s</code> 和 <code>t</code> 由任意有效的 ASCII 字符组成</li>
 | 
						||
</ul>
 |