자바스크립트에서 내장 메소드 사용 x
배열을 이용해 직접 구현 후 사용
class Queue {
items = [];
front = 0;
rear = 0;
push(item) {
this.items.push(item);
this.rear++;
}
pop(){
return this.item[this.front++];
}
isEmpty() {
return this.front === this.rear;
}
}'JS 코딩테스트' 카테고리의 다른 글
| [JS hash] object vs Map vs Set 차이 (0) | 2025.09.23 |
|---|---|
| js 코테 10분전 외워야 할 공식들 (0) | 2025.09.22 |
| [백준] 11866 요세푸스 (0) | 2025.08.17 |
| [JS 코테] LeetCode 2722. Join Two Arrays by ID (0) | 2025.05.05 |
| [LeetCode] 2667 create-hello-world-function (2) | 2024.11.12 |