Minimum length Unsorted Subarray, sorting which makes the array sorted | GeeksforGeeks

Find Complete Code at GeeksforGeeks Article: www.geeksforgeeks.org/minimum-length-unsorted-subarray-sorting-which-makes-the-complete-array-sorted/
Practice Problem Online Judge: practice.geeksforgeeks.org/problems/length-unsorted-subarray/0
This video is contributed by Shubham Kumar
Please Like, Comment and Share the Video among your friends.
Also, Subscribe if you haven't already! :)

Пікірлер: 12

  • @snipegams6832
    @snipegams68322 жыл бұрын

    He's so invested in reading it out that he even pronounced changed to chang-ed. Wow whatever the reason seems to be feel like we should empower more videos like this

  • @shubhadeepmahato5121
    @shubhadeepmahato51219 ай бұрын

    Very sort and best Explanation

  • @SachinSingh-lb2qz
    @SachinSingh-lb2qz Жыл бұрын

    with space complexity can have better solution it keep two array of min and max element till any index from l to r and r to L?

  • @knixkcodes
    @knixkcodes Жыл бұрын

    Great explanation

  • @looongtuan6315
    @looongtuan63152 жыл бұрын

    amazing !!

  • @wecan2729
    @wecan27293 жыл бұрын

    class Solution{ public: vector printUnsorted(int arr[], int n) { int s, e, max, min; vectorv; // step 1(a) of above algo for (s = 0; s { if (arr[s] > arr[s+1]) break; } if (s == n-1) { v.push_back(0); v.push_back(0); return v; } // step 1(b) of above algo for(e = n - 1; e > 0; e--) { if(arr[e] break; } // step 2(a) of above algo max = arr[s]; min = arr[s]; for(int i = s + 1; i max) max = arr[i]; if(arr[i] min = arr[i]; } // step 2(b) of above algo for( int i = 0; i { if(arr[i] > min) { s = i; break; } } // step 2(c) of above algo for( int i = n -1; i >= e+1; i--) { if(arr[i] { e = i; break; } } v.push_back(s); v.push_back(e); return v; } };

  • @guruprakash4588
    @guruprakash45883 жыл бұрын

    Thanks for reading the solution, I cannot read texts.

  • @ahishnar1568

    @ahishnar1568

    3 жыл бұрын

    try hard to think about solution by yourself first, atleast reach somewhat closer to the solution then look at the solution by GFG. if anyone seeing the solution directly without thinking anything about the solution then it is very difficult to get the solution because in that case you need a very well formed explaination by someone who is really good in explaining the solutions which is very hard to find. So it is better to try the above approach which I told. :)

  • @abijeetshyam8302
    @abijeetshyam83023 жыл бұрын

    Is this called expaination or reading ppts? I wonder!

  • @ahishnar1568

    @ahishnar1568

    3 жыл бұрын

    It is called as explaining by reading ppt's. :)

  • @siddharthachatterjee6590
    @siddharthachatterjee65904 жыл бұрын

    Fails for arrays with repeated element. A : [ 1, 1, 10, 10, 15, 10, 15, 10, 10, 15, 10, 15 ]

  • @ahishnar1568

    @ahishnar1568

    3 жыл бұрын

    I think the provided solution only possible for an array having non repeating elements.