Katkat

Calculate Jaccard Similarity Score for Two String Lists

ShopifyData Scientist · Onsite

Last updated

This question evaluates understanding of similarity metrics and competency in comparing string collections, reflecting knowledge of set-theoretic concepts and manipulation of collection data structures used in data processing.

Scenario

During pair programming, the interviewer asks you to compare two lists of merchant tags and quantify their similarity.

Question

Implement a Python function that takes two lists of strings and returns their Jaccard similarity score.

Hints

Convert both lists to sets, then compute |A ∩ B| ÷ |A ∪ B|.