Tiny Bunny
본문 바로가기

전체 글

(117)
Node.js 설치하기 (18.17.1 LTS) 제가 사용할 Node.js 버전은 18.17.1 LTS 입니다. 먼저 아래 사이트에 접속한 후 https://nodejs.org/ko/blog/release/v18.17.1 Node v18.17.1 (LTS) | Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. nodejs.org 스크롤을 조금만 내려 자신의 컴퓨터 환경과 맞는 걸 다운로드 합니다. 저는 Windows 64 bit 입니다. 다운로드가 완료된 파일을 더블클릭하여 설치를 진행합니다. Node.js runtime : Node.js runtime 본체 corepack manager : 패키지 관리자 - npm, yarn등의 패키지 관리자의 여러 버전을..
JavaScript (2) 보호되어 있는 글입니다.
프로그래머스 3단계 : 1차 셔틀버스 (Java 자바) import java.util.*; class Solution { public String solution(int n, int t, int m, String[] timetable) { String answer = ""; ArrayList list = new ArrayList(); for(int i=0; i= list.get(idx)){ lastTime = list.get(idx); // 마지막으로 탄 사람 갱신 idx++; cnt++; if(idx >= list.size()) break; }else{ break; } } busStartTime += t; } if(cnt < m){ // 마지막 버스에 자리가 있음 answer = time2str(busStartTime-t); }else { // 마지막 버스..
프로그래머스 3단계 : 자물쇠와 열쇠 (Java 자바) public class Solution { public boolean solution(int[][] key, int[][] lock) { int padSize = lock.length - 1; for (int i = 0; i < 4; i++) { key = rotate(key); int[][] paddedKey = pad(key, padSize); for (int j = 0; j < paddedKey.length - padSize; j++) { for (int k = 0; k < paddedKey.length - padSize; k++) { if (isValid(lock, paddedKey, j, k)) { return true; } } } } return false; } private boolean i..
프로그래머스 3단계 : 합승 택시 요금 (Java 자바) import java.util.*; class Edge implements Comparable{ int index; int cost; Edge(int index, int cost){ this.index = index; this.cost = cost; } @Override public int compareTo(Edge e){ return this.cost - e.cost; } } class Solution { static final int MAX = 20000001; // 200 * 100000 + 1 static ArrayList graph; public int solution(int n, int s, int a, int b, int[][] fares) { int answer = Integer.MAX_V..
프로그래머스 3단계 : 경주로 건설 (Java 자바) import java.util.*; public class Solution { public int solution(int[][] board) { int[] dy = {-1, 1, 0, 0}, dx = {0, 0, -1, 1}; int N = board.length; int[][][] cost = new int[N][N][4]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) Arrays.fill(cost[i][j], Integer.MAX_VALUE); Queue queue = new LinkedList(); queue.add(new int[]{0, 0, 0, 1}); queue.add(new int[]{0, 0, 0, 3}); while (!queue...
JavaScript (1) 2023-09-13 # 자바스크립트란? html 문서에 html이나 css만으로는 표현하기 어렵거나 불가능한 작업을 하기 위해 만들어진 스크립트 언어 html 문서에 직접 작성하거나 외부 파일에 작성된 후 불러올 수 있다. * 스크립트 언어? 메모장 등 간단한 텍스트 편집기 프로그램을 이용해서 쉽게 프로그램을 작성할 수 있도록 사용하기 편리하며 실행속도가 빠른 것이 특징 자바스크립트 내장 객체의 예로는 document가 있다. # 기본 문법 변수 선언 var 변수명 = 초기값 예 var firstName; var lastName = 'man'; var, let 둘 다 동작하는 데에는 문제가 없으나 요즘엔 let을 더 많이 사용한다. 왜? let의 경우 JS에서 한 번 더 검사하는 기능을 제공하고 있기 때..
프로그래머스 3단계 : 다단계 칫솔 (Java 자바) import java.util.*; class Solution { // 사람을 인덱스로 매핑 public Map people = new HashMap(); public int[] answer; // 각 인덱스의 최종 결과 public String[] parent;// 인덱스를 추천한 사람을 의미하는 변수 public int[] solution(String[] enroll, String[] referral, String[] seller, int[] amount) { parent = new String[enroll.length]; answer = new int[enroll.length]; for(int i = 0; i < enroll.length; i++) { people.put(enroll[i],i); /..