Max difference in an array O(n)