Dsa
Two Pointers
Easy
Max Distinct Pair
You are given an array of integers representing different product identifiers. Your goal is to find the maximum number of distinct product pairs you can form using two distinct product identifiers from the array, with the pair order not mattering. Write a function that returns the maximum number of distinct pairs that can be formed.
Input Format:
- A single line containing space-separated integers.
Output Format:
- An integer representing the maximum number of distinct pairs.
Example:
Input:
1 2 2 3 4 4
Output:
6
Key concepts
two_pointerspairscounting
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