Code Room
CodingEasycod-g1258
Subject HashingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Two curators each maintain a tag list for their own playlist, and tags may repeat within either list. To measure how similar the playlists are, count how many distinct tags appear in both lists (the size of the intersection of their distinct tag sets). Repeats never add to the count. For example, ["rock", "pop", "jazz"] and ["pop", "jazz", "folk", "pop"] share the two tags "pop" and "jazz", so the answer is 2. Return the count as an integer.

Implement
shared_tag_count(a: list[str], b: list[str]) → int
Examples
in[["rock","pop","jazz"],["pop","jazz","folk","pop"]]out2
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.