Given an array, print the largest subarray that has elements in an increasing order
Anonym
Algorithm: Lets say the input array is: 1 2 3 -4 4 5 6 7 8 9 0 1. Start with the first element and keep on increasing the count and index till you hit an element that is less than the previous element. In the above case -4 < 3, hence count =3, so store it in maxCount and LastIndex = index + 1 - count So, until this point 1 2 3 is the largest subarray. 2. Again start from -4, with index = 3 and count = 0 and keep on increasing the index and count till you hit an element which is less than the previous element. Here 0 < 9, hence you stop and compare the new count with the maxCount to see which is greater. Similarly, keep on following this till you hit the end of the array. Complexity - O(n)