java.lang.Object
g0801_0900.s0884_uncommon_words_from_two_sentences.Solution

public class Solution extends Object
884 - Uncommon Words from Two Sentences.<p>Easy</p> <p>A <strong>sentence</strong> is a string of single-space separated words where each word consists only of lowercase letters.</p> <p>A word is <strong>uncommon</strong> if it appears exactly once in one of the sentences, and <strong>does not appear</strong> in the other sentence.</p> <p>Given two <strong>sentences</strong> <code>s1</code> and <code>s2</code>, return <em>a list of all the <strong>uncommon words</strong></em>. You may return the answer in <strong>any order</strong>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s1 = &ldquo;this apple is sweet&rdquo;, s2 = &ldquo;this apple is sour&rdquo;</p> <p><strong>Output:</strong> [&ldquo;sweet&rdquo;,&ldquo;sour&rdquo;]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s1 = &ldquo;apple apple&rdquo;, s2 = &ldquo;banana&rdquo;</p> <p><strong>Output:</strong> [&ldquo;banana&rdquo;]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s1.length, s2.length <= 200</code></li> <li><code>s1</code> and <code>s2</code> consist of lowercase English letters and spaces.</li> <li><code>s1</code> and <code>s2</code> do not have leading or trailing spaces.</li> <li>All the words in <code>s1</code> and <code>s2</code> are separated by a single space.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details