Atlassian Interview Question

Code Design - Modify an Array Given an array, Find the Minimum Cost to Sort Ascendingly or Descendingly along its length. Cost is defined as: MOD(New Value-Orig Value) of the element.