DistinctSort

Medium

Given an array of integers, return the array sorted and with all duplicates removed.

Parameter(s):

  • arr: an array of integers

Returns:

  • array: an array of sorted, distinct integers

Constraints:

  • arr ≠ null
  • 1 ≤ arr.length ≤ 1000
  • -2147483647 ≤ arr[i] ≤ 2147483647

Example 1:

Input:

[5,4,3,2,1]

Output:

[1,2,3,4,5]

Example 2:

Input:

[3,2,2,1]

Output:

[1,2,3]

Example 3:

Input:

[1,1,2,2,3,3]

Output:

[1,2,3]