Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- C++
- moreeffectiveC++
- UE_LOG
- 선택정렬
- 데이터애셋
- 프로그래머스
- 구조적 바인딩
- dataasset
- 알고리즘
- 정렬알고리즘
- 델리게이트
- BFS
- 람다사용정렬
- UE4 커스텀로그
- 람다
- 애셋로드
- UML관련
- 약참조
- unorder_map
- 자료구조
- 크리티컬섹션
- 정렬
- enumasByue
- 언리얼가비지컬렉터
- stl
- C++최적화
- map
- 강참조
- UELOG
- 스마트포인터
Archives
- Today
- Total
기억을 위한 기록들
[프로그래머스 Lv2/C++] 주식가격 본문
#include <string>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> prices) {
//prices 주식가격 배열
// 1<=가격<=10000
//2<=prices 길이 <=100000
vector<int> answer;
int size = prices.size();
int i=0;
int cnt=0;
for(i =0;i<prices.size();i++)
{
cnt=0;
for(int j=i+1;j<prices.size();j++)
{
if(prices[i]<=prices[j])
{
cnt++;
}
else{
cnt++;
break;
}
}
answer.push_back(cnt);
}
return answer;
}
'Coding Test - cpp' 카테고리의 다른 글
[프로그래머스 lv 2 ] - 다음 큰 숫자 (0) | 2021.03.29 |
---|---|
[프로그래머스 lv 2 ] - N개의 최소공배수 (0) | 2021.03.29 |
[백준 1260 : DFS와 BFS] - C++ (0) | 2021.01.11 |
[C++] 소수 구하기 (에라토스테네스의 체) (0) | 2020.11.26 |
코딩 게임 - The Gift (C++) (0) | 2020.07.27 |