[Algorithm] 9 week(3.7 ~ 3.13) 2/3

Dev_min·2022년 3월 9일
0

algorithm

목록 보기
26/157

1441. Build an Array With Stack Operations

var buildArray = function(target, n) {
    const result = [];
    
    for(let i = 1; i <= target[target.length - 1]; i++){
        result.push("Push");
        if(!target.includes(i)) result.push("Pop");
    }
    
    return result;
    
};
profile
TIL record

0개의 댓글