Given an array $$$A$$$ of $$$N$$$ integers . Find the maximum of value of $$$i\ -\ j$$$ such that : $$$\newline$$$ $$$1)\ j\ <\ i \newline$$$ $$$2)\ A[j]\ <\ A[i] \newline$$$
Note : i and j are 0-based indices
Constraints : $$$ N \le 10^6 , A[i]\ \le\ 10^9\ for\ 0\ \le i\ \le\ N-1\newline $$$
Ex :
<li>A = [1,2,3,4,5] j = 0 , i = 4 gives maximum difference of 4 satisfying the given conditions </li> <li> A = [8,4,8,7,6,6,3] j = 1 , i = 5 gives maximum difference of 4 satisfying the given conditions </li>