Practice · 2 of 5
Descending Median
CHALLENGE
Difficulty: beginner+25 XP
**Description:** Given n integers, print them sorted in **descending**
order, then print the median. For even n, the median is the lower of the
two middle elements in the sorted-ascending order.
**Input:** Line 1: n (1 <= n <= 10^5). Line 2: n integers (|a_i| <= 10^9).
**Output:** Line 1: n sorted values descending, space-separated, no
trailing space. Line 2: the median.
**Example:** 4 / 3 1 4 2 -> line 1 4 3 2 1, line 2 2.
Press Submit to check your solution.
Back to lesson: Practice: Sorting Set