Check the array is Sorted or Not ?
If Sorted so in which order
Ascending or descending?
I/P:- 1,1,1,1,2,3,4,4,5,6,7
O/P:- Ascending order Sorted
I/P:- 9,9,8,7,6,5,5,5,5,4,3
O/P :- Descending order Sorted
I/P:- 1,1,2,3,3,4,3,3,4,5,6,7
O/P :- Not Sorted
I/P :- 9,9,9,8,7,6,5,5,6,4,3,2,1
O/P:- Not Sorted
Time Complexity :- O(n)
Note :- if you sort the input then match, sort function time Complexity is O(nlogn)
Expected time Complexity is O(n)
See test cases
Kushal
Alex
Vlad
Dima
Stefan
Roxifλsz 🇱🇹
Pavel
Yoh
Suicide Liza
Asdew
olli
Mar!o