Given a histogram, with bins of width = 1 and height represented by an array heights, find two most distant bins that are visible from one another. That is, between the two bins found there must not be any block with a height greater than the height of any of the two bins selected.
Example
input: height[] = {2, 7, 3, 1, 3, 1, 6, 1, 8, 1, 2};
output: {7, 8}
Visualized example is given in the image below.

I heard about this problem from a friend who interviewed at Microsoft. Any help, tips and ideas would be very much appreciated. Thanks guys!