result to store the indices of buildings with an ocean view.maxHeight to -1 to keep track of the tallest building seen so far.maxHeight.
result and update maxHeight to the current building's height.result list because the indices were added in descending order.result list.