728x90
```
import java.util.*;
class Solution {
public int[] solution(int[] prices) {
int len = prices.length;
int[] answer = new int[len];
for(int start = 0; start < len - 1; start++){
for(int end = start + 1; end < len; end++){
if(prices[start] > prices[end] || end == len - 1){
answer[start] = end - start;
break;
}
}
}
answer[len - 1] = 0;
return answer;
}
}
```
728x90
'알고리즘' 카테고리의 다른 글
[Java]프로그래머스 쇠막대기 (0) | 2019.04.15 |
---|---|
[Java]프로그래머스 프린터 (0) | 2019.04.15 |
[Java]프로그래머스 스킬트리 (0) | 2019.04.15 |
[Java] 프로그래머스 기능개발 (0) | 2019.04.15 |
우아한 테크코스 7번 문제 Cryptogram (0) | 2019.03.19 |