
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Note that if you have at least one occurrence of 1 in the array, then you can make all the other elements equal to 1 with one operation each.
Try finding the shortest subarray with a gcd equal to 1.