Question bank › Arrays
Dsa Arrays Hard

Matching Pairs

You are given two arrays of integers. Your goal is to find the maximum number of matching pairs (same value) between the two arrays. Each element from each array can only be used once. Print the count of matching pairs. The input consists of two lines; each line contains one integer array. Example: Input: 1 2 2 1 2 1 2 1 Output: 3

Key concepts

arraysfrequency countcombinatorics

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.