Question bank › Math
Dsa Math Medium

Common Factors

Given two positive integers, find all common factors between them. A common factor is a number that divides both integers without any remainder. Output the common factors in ascending order, separated by a space. Input: Two positive integers a and b on a single line, separated by a space. Output: A single line containing the common factors. Example: Input: 12 18 Output: 1 2 3 6

Key concepts

factorsmathgcd

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.