LIT2021015_AYUSH's blog

By LIT2021015_AYUSH, history, 3 weeks ago, In English

Given an array of integers ,the cost to change an element is abs(newvalue — initialvalue) .Determine the minimum cost to sort the array either ascending or descending .

1<=n<=1e3 1<=arr[i]<=1e9

I couldnt find its solution after so much brainstorming can anyone help me out with its solution?

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it