I used kind of a greedy approach but why it is wrong , i can’t figure that out ??
Getting WA but can't figure out why
@aryan_007 try this simple input test case
5
1 2 3 40 70
answer should be 113, but your output is 74.
1 Like
Okayyyyyy sir , got it , Thanks