Coding

Buildings with an Ocean View

Find all buildings that have an ocean view.

Input: heights = [1,2,3,4]

Output: [3]

Explanation: Since the ocean is to the right, only the rightmost tallest building (index 3) is not blocked by any others.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions