We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here to count the maximum possible number of pairwise disjoint beautiful pairs we store the frequecy of numbers which are matching in both array A and B.and we can add 1 extra to result as we can change one of the values in b.
Note:Here for last statement you have to look for the edge case if all the numbers of A matches with array B.then the total count will be (n-1)or (c-1)as its mandatory to change a number in a array.
Beautiful Pairs
You are viewing a single comment's thread. Return to all comments →
Here to count the maximum possible number of pairwise disjoint beautiful pairs we store the frequecy of numbers which are matching in both array A and B.and we can add 1 extra to result as we can change one of the values in b.
Note:Here for last statement you have to look for the edge case if all the numbers of A matches with array B.then the total count will be (n-1)or (c-1)as its mandatory to change a number in a array.