Identify the subArray in an Array, such that if it is sorted then whole array will be sorted.


Identify the subArray in an Array, such that if it is sorted then whole array will be sorted.


Output:
11                                                     //size of array
10 12 20 30 25 40 32 31 35 50 60  //array elements separated by space
30 25 40 32 31 35                           //sub array which needs to be sorted

another sample output.
13                                                    //size of array
1 2 4 7 10 11 7 12 3 7 16 18 19      //array elements separated by space
4 7 10 11 7 12 3 7                           //sub array which needs to be sorted


Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Profit and Loss