-
Notifications
You must be signed in to change notification settings - Fork 161
/
uncommon-words-from-two-sentences.md
40 lines (28 loc) · 1.34 KB
/
uncommon-words-from-two-sentences.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<p>We are given two sentences <code>A</code> and <code>B</code>. (A <em>sentence</em> is a string of space separated words. Each <em>word</em> consists only of lowercase letters.)</p>
<p>A word is <em>uncommon</em> if it appears exactly once in one of the sentences, and does not appear in the other sentence.</p>
<p>Return a list of all uncommon words. </p>
<p>You may return the list in any order.</p>
<p> </p>
<ol>
</ol>
<div>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input: </strong>A = <span id="example-input-1-1">"this apple is sweet"</span>, B = <span id="example-input-1-2">"this apple is sour"</span>
<strong>Output: </strong><span id="example-output-1">["sweet","sour"]</span>
</pre>
<div>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input: </strong>A = <span id="example-input-2-1">"apple apple"</span>, B = <span id="example-input-2-2">"banana"</span>
<strong>Output: </strong><span id="example-output-2">["banana"]</span>
</pre>
<p> </p>
<p><strong>Note:</strong></p>
<ol>
<li><code>0 <= A.length <= 200</code></li>
<li><code>0 <= B.length <= 200</code></li>
<li><code>A</code> and <code>B</code> both contain only spaces and lowercase letters.</li>
</ol>
</div>
</div>