Leetcode 2521. Distinct Prime Factors of Product of Array
Count how many distinct prime numbers divide the product of all elements in an integer array — equivalent to aggregating the prime factors of each element and returning the number of unique primes. With nums.length up to 10^4 and nums[i] ≤ 1000, efficient per-number factorization (e.g., using trial division or a small sieve) suffices.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.