1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 11:08:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/两句话中的不常见单词 [uncommon-words-from-two-sentences].html

36 lines
1.2 KiB
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p><strong>句子</strong> 是一串由空格分隔的单词。每个 <strong>单词</strong><em> </em>仅由小写字母组成。</p>
<p>如果某个单词在其中一个句子中恰好出现一次,在另一个句子中却 <strong>没有出现</strong> ,那么这个单词就是 <strong>不常见的</strong><em> </em></p>
<p>给你两个 <strong>句子</strong> <code>s1</code><code>s2</code> ,返回所有 <strong>不常用单词</strong> 的列表。返回列表中单词可以按 <strong>任意顺序</strong> 组织。</p>
<p>&nbsp;</p>
<ol>
</ol>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s1 = "this apple is sweet", s2 = "this apple is sour"
<strong>输出:</strong>["sweet","sour"]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s1 = "apple apple", s2 = "banana"
<strong>输出:</strong>["banana"]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s1.length, s2.length &lt;= 200</code></li>
<li><code>s1</code><code>s2</code> 由小写英文字母和空格组成</li>
<li><code>s1</code><code>s2</code> 都不含前导或尾随空格</li>
<li><code>s1</code><code>s2</code> 中的所有单词间均由单个空格分隔</li>
</ul>