Check Array Sorted Problem

Check Array Sorted Problem — ExecCode School DSA Practice

Solve the Check Array Sorted problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a list of whole numbers. Your task is to check if each number in the list is the same as, or larger than, the number before it. If all numbers follow this rule, print "Yes". If not, print "No".

Examples

Input 5 1 2 3 4 5; Output Yes. Input 5 5 4 3 2 1; Output No

Constraints

1<=N<=10^4

Practice Check Array Sorted free on ExecCode. Browse DSA problems, topic map, and placement guides.