Largest forward difference
First read the problem description.
As we traverse the array we keep track of the min
value. Each time we calculate the difference between the current number and the min
, if it’s larger than the lfd
we update the lfd
.
Comments
Source code of the solution(s):