Skip to content

Commit

Permalink
이슈 #407에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 2, 2024
1 parent 3e653b9 commit 833f7c7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Programmers/주식가격.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <string>
#include <vector>

using namespace std;

std::vector<int> solution(std::vector<int> prices) {
int size = prices.size();
std::vector<int> answer(size);

for(int i = 0; i < size; i++) {
int duration = 0;

for(int j = i + 1; j < size; j++) {
duration++;
if(prices[i] > prices[j]) break;
}

answer[i] = duration;
}

return answer;
}

0 comments on commit 833f7c7

Please sign in to comment.