Problem 2521 · Medium

Distinct Prime Factors of Product of Array

A prime divides the product exactly when it divides some element, so collect the prime factors of every element into one set.

Open the interactive visualisation