ProProfs interview question

Sort the array in ascending and descending order