Question bank › Two Pointers
Dsa Two Pointers Easy

Drink Pair Count

A restaurant keeps a record of the number of drinks ordered by table groups, represented as an array. Your task is to determine how many unique pairs of groups can be formed that together have an even total number of drinks. Input Format: - The first line contains an integer n (1 ≤ n ≤ 10^5) — the number of tables. - The second line contains n space-separated integers d_i (1 ≤ d_i ≤ 10^9) — the number of drinks ordered at each table. Output Format: - Print the count of unique pairs (i, j) such that i < j and the total number of drinks at tables i and j is even. Example: Input: 5 1 2 3 4 5 Output: 6

Key concepts

two_pointersarraypairwise

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.