Potential Friend?

Published by Mubashir Hassan in

Given two sets of two people's different interests, return whether both people have at least two things in common or have exact interests. Return true if there's a potential friend!

Examples

is_potential_friend(
  ["sports", "music", "chess"],
  ["coding", "music", "netfli", "chess"]
) ➞ true

is_potential_friend(
  ["cycling", "technology", "drawing"],
  ["dancing", "drawing"]
) ➞ false

is_potential_friend(
  ["history"],
  ["history"]
) ➞ true

Notes

Sets of interests may have varied lengths.

Watch a quick demo on how Edabit works.