help plz-begginer question
Function returns the maximum size of the common between the two arrays?
(function recieve (array a, length of a , array b, length of b ))
for ex:
array a{2,1,2,3}
array b{2,3}
the res would be 2.{2,3 shown in array a and its the max
array a{2,2,2}
array b{2}
the res would be 1.
array a{2,1,2,3}
array b{3,4,5}
the res would be 1.
array a{4,5,2,1,2,3}
array b{9,8,8,7,8,8,2,3}
the res would be 2.
hope u understood the question
i am stuck i cant figured it out ..
i thought to run with two loops
Code:
for (i=0; i<lenght of a; i++)
{
for (j=0; j<length of b; j++)
{
if(a[i]==b[j])
{
count++;
and here i got stuck i can keep the count .. but then when it founds another nums that are equals i dont know how to split the counter from 0 and then to check what is the max .
thank u .. and i really tried for a couple of hours and the right solution dont hit me .