I am not able to analyze how to solve this problem…
How this problem can be solved?
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
Thank you aastha,But how you figured out that i must use this approach??