• + 0 comments

    I've done the same thing that you have shown over here. But, for, say, 1 5 5, By this method, we get: (1) 5 5 (+ 0 steps) 1(5) 5 (+0 steps) 5 5 (9) (+2 steps) 9 9 9 (+2 steps) = 4 steps. However, in some other manner: (1) 5 5 (+0 steps) 1 (5) 5 (+0 steps) 6 5 (10) (+1 steps) sort() (5) 6 10 (+0 steps) 5 (6) 10 (+0 steps) 6 6 (11) (+1 steps) 11 11 11 (+1 steps) = 3 steps

    The actual answer for 1,5,5 is 3 but i get 4. Please shed a light on this, im still confused