Algorithm · Shopify · Easy
Implement jaccard_similarity(a: list[str], b: list[str]) -> float. Let A be the set of distinct strings in a, and let B be the set of distinct strings in b. Repeated strings within one list are ignored. The function returns: $$\frac{ A \cap B }{ A \cup B }$$ String matching is exact: uppercase and lowercase forms are different, and every whitespace character is part of the string. If both input lists are empty, return 1.0. If only one input list is empty, return 0.0. Do not…
Checking your access…