bro 2nd was very easy if we iterate in reverse order class Solution { public int maximumEnergy(int[] e, int k) { int ans = Integer.MIN_VALUE; for(int i=e.length-1; i>=e.length-k; i--){ int j=i; int temp = 0; while(j>-1){ temp += e[j]; ans = Math.max(ans,temp); j-=k; } } return ans; } }
@aniketmore87898 ай бұрын
There are many ways to do this. I just wrote which came to my mind first.
@GauravPatil-js2in8 ай бұрын
Thank You. 👍👍 I couldn't solve question C in the contest, but now I understand it clearly.
@Gaurav-sj6bd8 ай бұрын
Do you have list of standard DP problems?
@munvut8778 ай бұрын
go to CSES dp section
@aniketmore87898 ай бұрын
You can follow cses problem set and atcoder dp contest.
@kkkkkkkkkk8118 ай бұрын
Bhaiya i am going to be in 3rd year now after the summer vaccations...mai soch rha hu ki sirf contest du lc aur cf pr..aur dp graphs topic wise kru..bhaiya is it good way..and please could you tell should i participate in CP contest or solely focus on lc contest...i gave div 2 945 today..Could not even solve A ...please suggest what should i do..