Dsa
Arrays
Medium
Disjoint Array Pairs
Given an array of integers, find the maximum number of disjoint pairs that can be formed such that the sum of each pair is even. Each integer can only be used once.
Input:
- The first line contains an integer n (1 <= n <= 100) — the size of the array.
- The second line contains n space-separated integers, the elements of the array.
Output:
- Print the maximum number of pairs possible.
Example:
Input:
6
1 2 3 4 5 6
Output:
3
Key concepts
arrayspairing
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