Company: Amazon_july
Difficulty: medium
Vulnerability Factor Problem Description The developers at Amazon IAM are working on identifying vulnerabilities in their key generation process. The key is represented by an array of n integers, where the i th integer is denoted by key[i] . The vulnerability factor of the key ( key ) is defined as the maximum length of a subarray that has a Greatest Common Divisor (GCD) greater than 1. You are allowed to make a maximum of maxChange modifications to the array, where each modification consists of changing any one element in the array to any other value. Given an integer array key and an integer maxChange , find the least possible vulnerability factor of the key after making at most maxChange changes. Note: The length of an empty subarray is considered to be zero. Examples Example 1: Input: key = [2, 2, 4, 9, 6], maxChange = 1 Explanation: The length of key, n = 5. Here are some possible changes to make: Change the first element to 3. The array becomes key = [3, 2, 4, 9, 6] . The length