2023-12-09 18:42:21 +08:00
|
|
|
|
<p>给定两个由小写字母组成的字符串 <code>s1</code> 和 <code>s2</code>,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。</p>
|
2022-03-27 20:38:29 +08:00
|
|
|
|
|
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong> <code>s1</code> = "abc", <code>s2</code> = "bca"
|
2022-03-27 20:38:29 +08:00
|
|
|
|
<strong>输出:</strong> true
|
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
<p><strong>示例 2:</strong></p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong> <code>s1</code> = "abc", <code>s2</code> = "bad"
|
2022-03-27 20:38:29 +08:00
|
|
|
|
<strong>输出:</strong> false
|
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
<p><strong>说明:</strong></p>
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>0 <= len(s1) <= 100 </code></li>
|
|
|
|
|
<li><code>0 <= len(s2) <= 100 </code></li>
|
|
|
|
|
</ul>
|