I don't understand your example. If the input has only one "3", and the output has more than one, you have not sorted the elements. Do you mean alter the elements to make the array non-decreasing? Don
On Apr 25, 4:21 am, snehal jain <learner....@gmail.com> wrote: > Given n elements, sort the elements. Here, only one operation is > permitted decreaseValue.. > Note that you cannot swap the values.. output should be a sorted > list.. > if input is 4 5 2 1 3 > output is 3 3 3.. There can be many answers.. Give the optimum > solution with minimum cost. where as cost is the sum of decreased > amounts.. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.