Dynamic vs greedy


for input
5 9 4 4 5 5
expected output is 1
but answer should be 3
in case of 1 total=4+4=8(<=10)
in case of 3 total=5+5=10(<=10)
so i think they have used greedy approach
as the expected output is not optimal
in case of dynamic answer will be 3 and will be optimal


correct answer is [1 1]. We need to get maximum number of kicks, within limit. It did not say (5+5)(<=10) is more optimum than (4+4)(<=10).
1)we need to get more kicks
2) we need values of the indicies as less as possible.