#C5830. Non-decreasing Pillar Traversal
Non-decreasing Pillar Traversal
Non-decreasing Pillar Traversal
Given a sequence of pillar heights, determine if it is possible to traverse from the first pillar to the last one without ever stepping down to a lower pillar. In other words, check if the sequence is non-decreasing. Formally, given an array of integers \(a_1, a_2, \dots, a_n\), you must verify that \(a_i \leq a_{i+1}\) for all \(1 \leq i < n\). Output True
if the condition holds, and False
otherwise.
inputFormat
The first line of input contains an integer \(n\) representing the number of pillars. The second line contains \(n\) space-separated integers representing the heights of these pillars.
outputFormat
Output a single line containing either True
if it is possible to traverse without stepping down, or False
otherwise.
4
1 2 2 3
True
</p>