+ 4

Challenge: write a code to find whether the given array of interger elements is sorted or unsorted.

identify whether the array elements are sorted or unsorted

2nd Mar 2018, 8:40 AM
Amit Gharge
Amit Gharge - avatar
3 Antworten
+ 9
use Arrays.sort(array_name); & then by using a loop compare each corresponding element //alternative method also exists without using any loop
2nd Mar 2018, 9:08 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
It is encouraged to make challenges like this into assignments in lesson factory, rather than post them here in the Q/A https://www.sololearn.com/discuss/1082512/?ref=app
2nd Mar 2018, 9:02 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 2
C++ int arr[50]; for(int& i:arr) cin>>i; cout<<boolalpha<<is_sorted(arr,arr+50);
2nd Mar 2018, 9:59 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar