It would be great if they have the likes and dislike like in yahoo answers so that correct or rather best solutions can be looked at immediately then subsequently the other solutions!! second, if u cud give the link to the problem, even we can try the problem and submit it and gain some confidence that we code rite :)
Anyways here's the solution i propose 1) sort the array( keep track of their original indices!) from now on all operations on sorted array...... 2) since sorted, we need to locate i and j in sorted array such that index[j] - index[i] is maximum and i < j ....(looks similar to problem ah! i am wondering too)(i < j guarantees a[j] - a[i] > 0 ) 3) min[i] store the smallest index till i - 1, maximize i - min[i] O(nlogn) that too due to sorting :( ;) hope i am right and clear :) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
