Problem 3605 · Hard

Minimum Stability Factor of Array

A subarray is stable when the greatest common divisor of its values is at least 2. You may replace up to maxC elements with any integers; find the smallest achievable length of the longest stable subarray, or 0 when none remains.

Open the interactive visualisation