You are given an array 𝑎, consisting of 𝑛 integers. Each position 𝑖 (1≤𝑖≤𝑛) of the array is either locked or unlocked. You can take the values on the unlocke……