https://school.programmers.co.kr/learn/courses/30/lessons/131704
프로그램 제작자
코드 중심 개발자를 고용하십시오. 배치 기반 위치 매칭. 프로그래머의 개발자별 프로필에 가입하고 기술 호환성이 좋은 회사와 연결하십시오.
Programmer.co.kr
import java.util.*;
class Solution {
public int solution(int() order) {
int answer = 0;
Stack<Integer> stack = new Stack<>();
int size = order.length;
int index = 0;
for(int i = 1 ; i <= size ; i++){
if(order(index) != i){
stack.push(i);
}else{
index++;
answer++;
}
while(!stack.isEmpty() && stack.peek() == order(index)){
stack.pop();
index++;
answer++;
}
}
return answer;
}
}
