filmov
tv
Maximum Energy Boost From Two Drinks | Weekly contest 411 | Leetcode 3259 in Java | Must do TOP DP

Показать описание
You are given two integer arrays energyDrinkA and energyDrinkB of the same length n by a futuristic sports scientist. These arrays represent the energy boosts per hour provided by two different energy drinks, A and B, respectively.
You want to maximize your total energy boost by drinking one energy drink per hour. However, if you want to switch from consuming one energy drink to the other, you need to wait for one hour to cleanse your system (meaning you won't get any energy boost in that hour).
Return the maximum total energy boost you can gain in the next n hours.
My Approach is simple, i am making Dynamic Programming approach, i an starting solving the values from 2nd Row, as first row would be same as it is and then i am checking to pick a value from left upper side of the element and then from upper right side element and then getting the max of these both and adding the marginal value to it so that we will get the partial solution till (i+1)th row and at the end our final row with maximum value as answer.
counting Sort :-
DSA Algorithms :-
Design HLD:-
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish