You have a list of contacts where each contact has a list of emails.
We want to do a deduplication over these contacts (some kind of merge) such that all contacts that are completely included in another contact should be removed. If a contact is only partially included in another contact then we should keep it.
Example 1:
C1 - a@test.com, a@gmail.com
C2- a@test.com
Should return only C1 because C2 is fully included in C1
Example 2:
C1 - a@test.com, b@gmail.com
C2 - a@test.com, b@hotmail.com
Even though a@test.com is found in both C1 and C2 we still need to return C1 and C2 as both contacts have an email that is not included in the other.
Can you please post working solution? Thanks