[Facebook data engineer coding] find uncommon words between 2 strings.

Data Science Interview QuestionsCategory: Data Engineer Coding[Facebook data engineer coding] find uncommon words between 2 strings.
1 Answers
MockInterview Staff answered 10 months ago

(please indent properly before running, Python implementation below) 
def uncommon_words(str1,str2):
set_1 = set(str1.split(‘ ‘))
set_2 = set(str2.split(‘ ‘))
difference = (set_1 – set_2) | (set_2 – set_1)
return list(difference)

Your Answer

3 + 0 =