Fetching data...
This may take a moment
Back
1909. Buildings With an Ocean View
Medium
Array
Stack
Monotonic Stack
Solve on LeetCode
View Solutions
Description
Hints
Hint 1
You can traverse the buildings from the nearest to the ocean to the furthest.
Hint 2
Keep with you the maximum to the right while traversing to determine if you can see the ocean or not.
Similar Questions
Number of Visible People in a Queue
Hard
Finding the Number of Visible Mountains
Medium
Statistics
Acceptance
80.9%
Submissions
416,739
Accepted
337,063