Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. private static int BozhoScore(HashSet<string> firstPicTags, HashSet<string> secondPicTags)
  2.         {
  3.             var intersection = new HashSet<string>(firstPicTags);
  4.  
  5.             intersection.IntersectWith(secondPicTags);
  6.  
  7.             var intersectionCount = intersection.Count;
  8.  
  9.             var firstDiffSecondCount = firstPicTags.Except(secondPicTags).Count();
  10.  
  11.             //Could probably add slight improvements. allCount - (intersect + firstDiff)
  12.             var secondDiffFirstCount = secondPicTags.Except(firstPicTags).Count();
  13.  
  14.             return Math.Min(Math.Min(intersectionCount, firstDiffSecondCount), secondDiffFirstCount);
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement