c# 4.0 - Check if in one integer array are exactly a number of matches in c#? -


i have array of 25 numbers , have array of 15 numbers. fastest way found (no more, no less) 5 matches of 15 numbers in 25 numbers array?

example:

int[] array1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }  int[] array2 = { 1, 2, 3, 4, 5, 36, 77, 88, 49, 50, 51, 52, 53, 54, 55 }  int[] array3 = { 1, 2, 3, 4, 5, 6, 26, 17, 28, 29, 30, 31, 32, 33, 34 }  int[] array4 = { 1, 2, 3, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 } 

in example array2 valid array because has 5 matches array3 , array4 not valid.

int[] array1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; int[] array2 = { 1, 2, 3, 4, 5, 36, 77, 88, 49, 50, 51, 52, 53, 54, 55 };  int nummatches = array1.intersect(array2).count(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -