Check If Array Is Sorted

easy
1. You are given an array of integers.
  2. You have to check whether the array is sorted in non-decreasing order or not.
  3. For example, 
  Input: arr[] = {1,3,4,4,5,6,7}
  
  Output: Yes
  
  Note:
  1. main takes input from the users.
  2. display is a utility function that displays an array. Feel free to use it for debugging purposes.
  3. This is a functional problem.
  4. You have to complete the function isSorted. It takes as input the given array. It should return true if the array is sorted, else should return false.

Input Format

First line takes input N, the length of the given array. Second line takes input N space separated integers representing the elements of the array. Input is handled for you.

Output Format

Yes or No. Output is handled for you.

Constraints

N/A

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
7
1 3 4 4 5 6 7
Output
Yes
Previous
Move Zeroes
Next
Replace By X

Related Questions