This is a verified interview question from Phonepay. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Energy Channel Optimization - Phonepay Online Assessment MNNIT Allahabad" covers key patterns like Arrays.
"A laboratory operates two independent energy channels. An experiment consists of N phases. During each phase, each channel performs either: - I x (Inject): Inject x units of fresh energy. - A x (Amplify): Amplify the energy currently in that channel by x, effectively creating (x-1)×current_energy additional units. Freshly generated energy in a phase may be routed to either channel. Energy already present in a channel cannot later be transferred. Initially both channels contain exactly 1 unit of energy. Determine the maximum total energy after all phases. Input Format - For each experiment: - I x = Inject - A x = Amplify - Integer N. - Next N lines: LeftOperation LeftValue RightOperation RightValue Sample Input 1: 3 I 8 A 2 A 3 I 9 I 4 A 2 Sample Output 1: 74 Sample Input 2: 3 I 5 A 2 A 2 A 3 I 4 I 8 Sample Output 2: 35"
Join thousands of developers practicing for Phonepay.