Company: Thoughtspot
Difficulty: medium
1. Equal Neurons There is a neural network with n layers where the number of neurons in the i th layer is denoted by layer[i], for all (0 ≤ i Find the minimum generation in which all the layers can have an equal number of neurons. Function Description Complete the function findMinGeneration with the following parameters: vector<int> layer : the number of neurons in the layers of the network Returns long : the minimum number of generations that can have an equal number of neurons for all layers Constraints 1 ≤ n ≤ 10 5 1 ≤ layer[i] ≤ 10 9 Example 1 Given n = 4 and layer = [1, 1, 2, 4] Generation Selected Layer Updated Layers 1 1 [2, 1, 2, 4] 2 1 [4, 1, 2, 4] 3 2 [4, 2, 2, 4] 4 2 [4, 4, 2, 4] 5 None chosen [4, 4, 2, 4] 6 3 [4, 4, 4, 4] The 6 th generation is the minimum in which all the layers can have an equal number of neurons, i.e., 4. Sample Case 0 Input: 3 3 3 6 Output: 4 Generation Selected Layer Updated Layers 1 1 [4, 3, 6] 2 1 [6, 3, 6] 3 2 [6, 4, 6] 4 2 [6, 6, 6] The 4th g