1762. Buildings With an Ocean View
单调栈
Input: heights = [4,2,3,1]
Output: [0,2,3]
Explanation: Building 1 (0-indexed) does not have an ocean view because building 2 is taller.Input: heights = [4,3,2,1]
Output: [0,1,2,3]
Explanation: All the buildings have an ocean view.Input: heights = [1,3,2,4]
Output: [3]
Explanation: Only building 3 has an ocean view.Last updated