Problem 2654 · Medium

Minimum Number of Operations to Make All Array Elements Equal to 1

Create one 1 from the shortest subarray whose gcd is 1, then spread that 1 to every other element.

Open the interactive visualisation