How to check if two lists contain overlapping elements
Want to check if two lists have overlapping elements in Elixir?
Use some set theory! 💡
-
Turn the lists into MapSets with
MapSet.new(list)
-
See if the two sets are disjoint with
MapSet.disjoint?/2
Check it out: 👉 https://youtube.com/shorts/X9Gl-gd3tEg 👀
Read next Upload Encrypted Files to S3