You are viewing a single comment's thread. Return to all comments →

what is the output for the test case

1 3 1 5 5

my answer is 4 but correct output showing is 3 can someone explain me the reason for this test case?

The optimal solution for 1 5 5 is as follows: 1- 1+5,5,5+5 -- 6,5,10 2- 6+5,5+5,10 -- 11,10,10 3- 11,10+1,10+1 -- 11,11,11

So that could be done in 3 steps.

This is the explanation i was looking for this test case. Thanks!

## Equal

You are viewing a single comment's thread. Return to all comments →

what is the output for the test case

my answer is 4 but correct output showing is 3 can someone explain me the reason for this test case?

The optimal solution for 1 5 5 is as follows: 1- 1+5,5,5+5 -- 6,5,10 2- 6+5,5+5,10 -- 11,10,10 3- 11,10+1,10+1 -- 11,11,11

So that could be done in 3 steps.

This is the explanation i was looking for this test case. Thanks!