
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How does the GCD of an array change when you add more elements to a subarray?
The GCD will always decrease when increasing the size of the subarray,
Keep adding elements to a subarray and if adding a new element will make the GCD = 1, add a new split and a new subarray.