Level
프로그래머스 Lv2
Recruitment
function solution(heights) {
  return heights.map((h, i) => {
    while (heights[i] <= h) {
      i--;
    }
    return ++i;
  });
}