https://ide.codingblocks.com/s/56075
what is wrong in the logic??
Maximum length biotonic subarray getting wrong answer
Hey Vishesh, your approach is not correct, here I am sharing my approach, you can refer this.
- Initialize I[0] to 1 and D[n-1] to 1
- Creating I[] array
a. Till end of the array ie, i=1 to n, if arr[i] > arr[i-1] then I[i] = I[i-1] + 1. else, I[i] = 1 - Creating D[] array
a. From the end of the array ie, i = n-2 till i =0, if arr[i] > arr[i+1] then D[i] = D[i +1] +1 else, D[i] = 1