https://school.programmers.co.kr/learn/courses/30/lessons/42584
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> prices) {
vector<int> answer;
for (int idx = 0; idx < prices.size(); idx++)
{
int cnt = 0;
for(int idx_a = idx + 1 ; idx_a < prices.size() ; idx_a++) {
cnt++;
if (prices[idx] > prices[idx_a]) break;
};
answer.push_back(cnt);
}
return answer;
}
'Coding Test > Programmers' 카테고리의 다른 글
[Programmers] (깊이/너비 우선 탐색(DFS/BFS)) Lv 2. 게임 맵 최단거리 (0) | 2023.07.11 |
---|---|
[Programmers] (Summer/Winter Coding(~2018)) Lv 2. 방문 길이 (0) | 2023.07.10 |
[Programmers] Lv 2. 땅따먹기 (0) | 2023.07.09 |
[Programmers] (2019 KAKAO BLIND RECRUITMENT) Lv 2. 오픈채팅방 (0) | 2023.07.09 |
[Programmers] (2022 KAKAO BLIND RECRUITMENT) Lv 2. 주차 요금 계산 (0) | 2023.07.07 |
댓글