Number of Visible People in a Queue
There are n people standing in a queue, and each person has a height represented by an integer. You are given an array heights where heights[i] is the height of the ith person in the queue.
A person can see another person in front of them if the other person's height is greater than or equal to their own height. More formally, a person i can see person j if j ≥ i and heights[j] ≥ heights[i].
Return an array answer where answer[i] is the number of people that person i can see in front of them.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)