You are viewing a single comment's thread. Return to all comments →
It doesn't give optimal solution in all cases.
TC => 2 5 5 5 5 5
I implemented it so I know. The problem occurs because we are always adding to lower elements which causes problems as it is not proved to be safe move.
Also it give TLE.