Tap here to switch tabs
Problem
Submissions

Problem: Uncommon Words from Two Sentences

med
30 min
Try to solve the Uncommon Words from Two Sentences problem.

Statement

A sentence is a string of single space separated words where each word consists only of lowercase English letters.

A word is considered uncommon if it appears exactly once in one of the sentences and does not appear in the other sentence.

Given two sentences s1 and s2, return a list of all the uncommon words. The answer may be returned in any order.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤200\leq 200

  • s1 and s2 consist of lowercase English letters and spaces.

  • s1 and s2 do not have leading or trailing spaces.

  • All the words in s1 and s2 are separated by a single space.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Uncommon Words from Two Sentences

med
30 min
Try to solve the Uncommon Words from Two Sentences problem.

Statement

A sentence is a string of single space separated words where each word consists only of lowercase English letters.

A word is considered uncommon if it appears exactly once in one of the sentences and does not appear in the other sentence.

Given two sentences s1 and s2, return a list of all the uncommon words. The answer may be returned in any order.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤200\leq 200

  • s1 and s2 consist of lowercase English letters and spaces.

  • s1 and s2 do not have leading or trailing spaces.

  • All the words in s1 and s2 are separated by a single space.