Company: citadel_3oct
Difficulty: medium
Minimum Generations for Equal Layers Problem Description A neural network has n layers, where the number of neurons in the i -th layer is layer[i] . The network grows one generation at a time, and the generations are numbered 1, 2, 3, ... . In each generation the system may select at most one layer and add neurons to it: In an odd-numbered generation, 1 neuron is added to the selected layer. In an even-numbered generation, 2 neurons are added to the selected layer. A generation may also pass without any layer being selected. Neurons are only ever added, never removed. Find the minimum generation in which all layers can have an equal number of neurons. Complete the function findMinGeneration(layer) . It receives the array layer and returns a long : the minimum number of generations until all layers can have an equal number of neurons. Input Format Read from standard input. n layer[0] layer[1] ... layer[n-1] Line 1 contains the integer n , the number of layers. Each of the next n lines c