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] . In each generation, the system adjusts the neurons as follows: In odd generations: 1 neuron can be added to at most one layer In even generations: 2 neurons can be added to at most one layer Find the minimum generation in which all layers can have an equal number of neurons. For example, consider n = 4 and layer = [1, 1, 2, 4] : Explanation: The goal is to make all layers equal to the maximum initial value, which is 4 in this case. We need to increase layers 0, 1, and 2. Generation 1 (odd): Add 1 neuron to layer 0. Layers become [2, 1, 2, 4] . Generation 2 (even): Add 2 neurons to layer 0. Layers become [4, 1, 2, 4] . Generation 3 (odd): Add 1 neuron to layer 1. Layers become [4, 2, 2, 4] . Generation 4 (even): Add 2 neurons to layer 1. Layers become [4, 4, 2, 4] . Generation 5 (odd): No layer needs exactly 1 neuron to reach 4 (layer 2 need