Skip to content

주식가격 #407

@fkdl0048

Description

@fkdl0048
#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;
}

Metadata

Metadata

Assignees

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions