পোস্টগুলি

অক্টোবর, ২০২১ থেকে পোস্টগুলি দেখানো হচ্ছে

Minimum Sub Array to Sort

  Q91 :  Given an unsorted array of specific size. Write a program in C to find the minimum length of subarray such that,  sorting this subarray makes the whole array sorted. Expected  The given array is: 10 12 15 17 28 32 42 18 56 59 67 The minimum length of unsorted subarray which makes the given array sorted lies between the index 4 and 7 Solution :  #include<iostream> using namespace std; int main(){     int n;     cin>>n;     int arr[n];     for(int i=0;i<n;i++){         cin>>arr[i];     }     int li=n,ri=0;     for(int i=0;i<n-1;i++){         if(arr[i]>arr[i+1]){             cout<<"Get disorder "<<i+1<<endl;             ri=i+1;             int lli=0;             for(int j=i-1;j>...