Company: Impetus_21nov
Difficulty: medium
Problem Description You handed Farid N energy bars such that the i-th bar takes A[i] minutes to finish. Eating the i-th bar also supplies Farid with B[i] energy units. Farid only has T minutes available to consume as many of the bars as he chooses. He is permitted to start eating one bar during the T-th minute no matter how long that bar would normally take. Your task is to determine the maximum energy units Farid can obtain within T minutes. Examples Example 1 Input: N = 2, T = 60, A = [10, 100], B = [10, 100] Output: 110 Explanation: Farid can finish the first bar, which needs 10 minutes, within the first 10 minutes. Then during the final minute he can start the second bar. Total energy = 10 + 100 = 110. Example 2 Input: N = 2, T = 100, A = [100, 100], B = [100, 100] Output: 100 Explanation: Farid can only start one bar in the last minute, leaving the first 99 minutes unused. Example 3 Input: N = 3, T = 60, A = [10, 10, 10], B = [10, 20, 30] Output: 60 Explanation: Farid can finish a