Dsa
Math
Medium
Distinct Prime Factors
Write a function that finds the count of distinct prime factors for a given positive integer n.
Input Format:
A single integer n (1 <= n <= 10^6).
Output Format:
An integer representing the number of distinct prime factors of n.
Example:
Input:
28
Output:
2
Key concepts
primefactorizationset
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