#K90317. Maximize Sunlight
Maximize Sunlight
Maximize Sunlight
You are given an array of building heights. Your task is to arrange these buildings in an order that maximizes the sunlight each building receives. In practical terms, this means sorting the buildings in ascending order so that shorter buildings, which could be blocked by taller ones, are placed in front. Formally, given an array \(a_1, a_2, \ldots, a_n\), you need to output a permutation of the array such that \(a_{i_1} \leq a_{i_2} \leq \ldots \leq a_{i_n}\). This makes sure that for every building, there is no taller building in front of it.
Note: The input is provided via standard input and the output should be printed to standard output.
inputFormat
The first line of input contains an integer \(n\) \( (1 \leq n \leq 10^5)\) representing the number of buildings. The second line contains \(n\) space-separated integers representing the heights of the buildings.
outputFormat
Output the sorted list of building heights in ascending order on a single line with each number separated by a single space.
## sample1
5
5
</p>