Easy · Stacks & Queues
Buildings With an Ocean View
Given an array heights of positive building heights in a row, with the ocean to the right of the last building, return the 0-based indices, in increasing order, of the buildings whose every building to the right is strictly shorter.
Examples
Example 1
[4,2,3,1]Output: [0,2,3]
Example 2
[1,3,2,4]Output: [3]
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.