Understand what the interviewer is asking for by using test cases and questions about the problem.
artifacts1
and artifacts2
.Plan the solution with appropriate visualizations and pseudocode.
General Idea: Use sets to find the intersection of the two lists, which gives the common artifacts.
1) Convert `artifacts1` and `artifacts2` to sets.
2) Find the intersection of the two sets.
3) Convert the resulting set back to a list and return it.
⚠️ Common Mistakes
def find_common_artifacts(artifacts1, artifacts2):
# Convert the lists to sets to find the intersection
set1 = set(artifacts1)
set2 = set(artifacts2)
# Find common artifacts using set intersection
common_artifacts = set1 & set2
# Convert the result back to a list
return list(common_artifacts)