Maximum Diversity
For a given array $B$, we can divide the array into $2$ **non-empty** [subsequences](https://en.wikipedia.org/wiki/Subsequence), such that, each element of the array is present in **exactly** one of the subsequences. Let $X$ and $Y$ denote the [GCD](https://en.wikipedia.org/wiki/Greatest_common_divisor) of all elements of the first and second subsequence respectively. We define the *maximum di
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start