Kevin and His Cards Problem Statement
Kevin has two packs of cards. The first pack contains N cards, and the second contains M cards. Each card has an integer written on it. Determine two results: the total number of distinct card types when considering both packs together, and the number of card types present in both packs.
Note:
Two cards are of different types if their numbers differ.
Example:
Input:
T = 1
N = 3, M = 3
First pack: [2, 3, 5]
Second pack: [3, 4, 5]
Output:
4 2
Explanation:
The distinct card types when both packs are combined are {2, 3, 4, 5}, totaling 4. The common card types between the two packs are {3, 5}, totaling 2.
Constraints:
1 <= T <= 10
1 <= N, M <= 500
-10^9 <= arr[i] <= 10^9
- Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
Top Adobe Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app