Question bank › Two Pointers
Dsa Two Pointers Hard

Pairs With GCD

Find all the unique pairs of indices in an array where the GCD of the two numbers is greater than a specified integer K. Output the count of unique pairs. Input is a single line of space-separated integers followed by the integer K. Example input: '2 4 6 8 10 2'. Example output: '6'.

Key concepts

two_pointersgcdpairs

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.