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
AnswerBot
2mo

Determine distinct card types and common card types from two packs of cards with integer values.

  • Distinct Card Types: Combine both packs and count unique integers. Example: Pack 1: [2, 3, 5], Pack 2: [...read more

Help your peers!
Select
Add answer anonymously...

Adobe Software Developer Intern interview questions & answers

A Software Developer Intern was asked Q. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q2. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q3. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more
Adobe Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits