---
layout: post
title:  " [Programmers] 42588. 탑 "
categories: Algorithm
tags: Programmers reSolve
author: goodGid
---
* content
{:toc}

## Problem 
Problem URL : **[탑](https://programmers.co.kr/learn/courses/30/lessons/42588)**








---

## [1] Answer Code (18. 09. 27)

``` cpp
#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<int> heights) {
    vector<int> answer;
    int size = (int) heights.size();
    for(int i=0; i<size; i++){
        int tmp = 0;
        for(int j=i-1; j>=0; j--){
            if(heights[i] < heights[j]){
                tmp = j+1;
                break;
            }
        }
        answer.push_back(tmp);
    }
    return answer;
}
```

### Review

* 단순 이중 for loop로 해결

* 출처는 [한국 정보 올림피아드](https://www.digitalculture.or.kr/koi/selectOlymPiadDissentList.do)이다.

Write PGM Post " 42588. 탑 "
Write PGM Post " 42588. 탑 "
