// 주식가격 - 스택/큐
public class StockPrice {
public int[] solution(int[] prices) {
int[] answer = new int[prices.length];
for (int i = 0; i < prices.length - 1; i++) {
for (int j = i + 1; j < prices.length; j++) {
if (prices[i] > prices[j]) {
answer[i] = j - i;
break;
}
if (j == prices.length - 1) {
answer[i] = prices.length - i - 1;
}
}
}
return answer;
}
public static void main(String[] args) {
StockPrice s = new StockPrice();
int[] prices = { 1, 2, 3, 2, 3 };
s.solution(prices);
}
}