
Problem
Suppose we are given an array of n integers representing stock prices
on a single day. We want to find a pair (buyDay, sellDay), with buyDay
≤ sellDay, such that if we bought the stock on buyDay and sold it on
sellDay, we would maximize our profit.
OR
Given an array arr[] of integers, find out the difference between any two elements such that larger element appears after the smaller number in arr[].
Example
Input = {5 10 4 ...