1. 주식가격
- 스택/큐 활용 문제인데 그냥 구현으로 풀려서 구현으로 푼 문제
package problem_solving.stack;
import java.util.Arrays;
import java.util.Stack;
public class Programmers_42584 {
public static void main(String[] args) {
int [] prices = {1, 2, 3, 2, 3};
System.out.println(Arrays.toString(solution(prices)));
}
public static int[] solution(int[] prices) {
int[] answer = new int[prices.length];
for(int i = 0 ; i < prices.length;i++) {
int basic = prices[i];
for(int j = i+1 ; j< prices.length;j++) {
int compare = prices[j];
if( basic <= compare) {
answer[i]++;
}else {
answer[i]++;
break;
}
}
}
return answer;
}
}
2. 백준 레벨 변동
3. 풀이 유형
![](https://velog.velcdn.com/images/changi_gg/post/140201c3-638f-4788-98b1-6140b2f4b6d7/image.png)