https://ide.codingblocks.com/s/55515
https://hack.codingblocks.com/contests/c/537/428
what is wrong in this code?
https://ide.codingblocks.com/s/55515
https://hack.codingblocks.com/contests/c/537/428
what is wrong in this code?
you are using greedy approach
Failing test case
4
3 9 1 2
your answer
5
correct answer
11
use Dynamic programming
Greedy approach​:sweat_smile:
???
greedy approach ki phle jo laga ki maximum dega wo answer main maan liya, you used it like 3 9 1 2
you just check ki 3>2 so it will include in answer .
bt u can maximize answer by opting 2
So that in next turn you can pick 11.
dont worry you will learn greedy and Dp approach in upcoming lectures, just try to make logic correct according to given failing test case