Home > Back-end >  O bosses use hash table method to solve the problem for me
O bosses use hash table method to solve the problem for me

Time:09-21

884. The two sentences of no common words
Given A and B two sentences, sentence is A string of space separated by words, each word consists only of lowercase letters,)

If a word appears only once in one sentence, did not appear in a sentence, the word is not common,

Returns all not a list of common words,

You can return to the list, in any order



Example 1:

Input: A="this apple is sweet", B="this apple is sour"
Output: [" sweet ", "sour"]
Example 2:

Input: A="apple apple", B="banana"
Output: [" banana "]


Tip:
0 & lt;=a. ength & lt;=200
0 & lt;=B.l ength & lt;=200
A and B are only contain Spaces and lowercase letters,

//it's too difficult, I can't find understand on LeetCode C answers, why is everyone don't like problem solving with C language?
//I read the title to guess this problem is to use a hash table, can put each word into digital mapping, statistics and frequency of each word, but I just couldn't write the code, strives for the big help, comment, I am a small white
  • Related