Question bank › Hashing
Dsa Hashing Warm-up

Pairs with Given Sum

Write a program that reads a list of integers and a target sum, and determines how many pairs of integers (i, j) exist such that i + j equals the target sum. Each pair should be counted only once. Example Input: 1 2 3 4 5 6 Example Output: 2

Key concepts

hashingarrays

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.