69. Is the Line Sorted?

Acceptance — 0 accepted 0 submissions

Easy
Arrays
No companies listed
For the assembly, students must stand in order of height from shortest to tallest. Equal heights may stand together.

Given the heights in line order, check whether the line is sorted in non-decreasing order.

Input Format
The first line has n.
The second line has n heights.

Output Format
Print Yes if the line is sorted, otherwise No.

Constraints
• 1 ≤ n ≤ 1000
• 1 ≤ height ≤ 300

Example 1

Input
5
120 125 125 130 140
Output
Yes

Explanation Every student is at least as tall as the one before.

Example 2

Input
4
120 135 128 140
Output
No

Explanation 135 comes before 128, so it is not sorted.

Example 3

Input
1
150
Output
Yes

Explanation One student is always in order.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
Yes
No results yet
Run your code to test it against the sample cases.
Problem List