전체 글
-
항해 99 5기 TIL_45항해 99 2022. 2. 24. 02:02
▶ Today I Learned [5와 6의 차이] 소요 시간: 30분 해결 여부: 해결 /*5와 6의 차이*/ // 최댓값인 경우 5를 6으로 변환 // 최솟값인 경우 6을 5로 변환 let num1 = 111 let num2 = 25 let min = 0 let max = 0 // 최댓값 구하기 // 반복문의 길이를 저렇게 짜는 이유는 두 수의 길이가 다를 수 있기 때문! // 둘 중 무조건 큰 수를 기준으로 한다면 문제 없이 첫 인덱스부터 끝 인덱스까지 돌 수 있음 let arr1 = (num1+ "").split('') let arr2 = (num2+ "").split('') console.log(arr1) console.log(arr2) let i = 0 while (i < (Math.max(n..
-
항해 99 5기 TIL_44항해 99 2022. 2. 23. 02:33
▶ Today I Learned [DFS, BFS] 그래프 탐색 알고리즘 -> 하나의 점으로부터 시작해 모든 점을 한번씩 방문하는 것 ex) 특정도시에서 다른 도시로 갈 수 있는지 없는 지 깊이 우선 탐색 (Depth-First Search) - 하나의 노드에서 시작해 다음 분기로 넘어가기 전 까지 해당 분기를 완벽히 탐색하는 방법, 넓게 탐색하기 보다는 깊게 탐색 ex) 미로에서 길을 찾을 때 우선 하나의 길로 가서 갈 수 있는 곳까지 감 -> 막다른 길이라면 가장 가까운 갈림길로 되돌아와 이곳으로부터 다시 다른 방향으로 탐색을 진행하는 방법과 유사 모든 노드를 방문하고자 할 때 사용하는 것이 적절 간단함: 깊이 우선 탐색 > 너비 우선 탐색 단순 검색 속도: 깊이 우선 탐색 < 너비 우선 탐색 넓이 ..
-
항해 99 5기 TIL_43항해 99 2022. 2. 22. 05:40
▶ Today I Learned 다익스트라 알고리즘 :최단 경로를 찾는 알고리즘 https://mattlee.tistory.com/50 링크를 참조하면 이해가 빠르다 :) [서버 배포] EC2 생성 github에 파일 올려놓기 sudo chmod 400 받은 키페어 끌어다 놓기 (키페어의 접근 권한을 바꿔준다.) ssh -i 받은키페어를끌어다놓기 ubuntu@AWS에적힌내아이피 (SSH로 접속하기) 서버에 node.js 설치 curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs 서버에 MongoDB 설치 wget -qO - https://www.mongodb.org/static/pgp/se..
-
항해 99 5기 WIL_6항해 99 2022. 2. 20. 22:09
▶ Weekly I Learned (회고) 벌써 항해의 절반 시점을 향해 달려가고 있다. 프론트엔드와 백엔드로써 협업하는 것은 이번이 처음인 지금, 많이 새롭다. 기존에는 프론트와 백을 내가 둘 다 고려하므로써 둘 간의 연결을 어떻게 지을지를 고려하지 않아도 되었다. 그러나 지금의 나는 엄연히 백엔드 부분만을 다루기에 초반에는 어떻게하면 프론트엔드와 백엔드를 연동시킬 수 있을지 감이 오질 않았다. 하지만 한번 협업을 해보고 나니 조금은 감이 온다. 둘 간의 협업 중 가장 중요한 것은 세 가지 인듯 하다. 1) 서로 간의 영역에 대해서 조금은 알고 있을 것 2) 둘 간의 사이가 이어지는 부분인 router 요청이 어떻게 넘어오는 지 관찰하는 것 3) API명세서 상의 DB 구조나 url, 변수 등의 명칭을..
-
항해 99 5기 TIL_42항해 99 2022. 2. 20. 22:08
▶ Today I Learned [유기농 배추] 소요시간: 1시간 + 2시간 30분 해결 여부: 미해결 https://www.acmicpc.net/problem/1012 const input = require("fs").readFileSync('/dev/stdin').toString().trim().split('\n'); let inputIndex = 1 let t = input[0].trim()/1 let j = 0 while(0 < t) { j = j + input[inputIndex].trim().split(' ')[2]/1 + 1 let x = Array(input.length - 1).fill(0) let y = Array(input.length - 1).fill(0) let answer = 0..
-
항해 99 5기 TIL_41항해 99 2022. 2. 20. 22:07
▶ Today I Learned [동전] 소요시간: 30분 해결 여부: 해결 https://www.acmicpc.net/problem/11047 const fs = require("fs") let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n'); let info = input[0].split(' ') let n = info[0]/1 let k = info[1]/1 let a = [] let count = 0 for (let i = 1; i 0) { if (1
-
항해 99 5기 TIL_40항해 99 2022. 2. 19. 03:18
▶ Today I Learned [동전] 소요시간: 30분 해결 여부: 해결 https://www.acmicpc.net/problem/11047 /* 동전 준규가 가지고 있는 동전은 총 N종류이고, 각각의 동전을 매우 많이 가지고 있다. 동전을 적절히 사용해서 그 가치의 합을 K로 만들려고 한다. 이때 필요한 동전 개수의 최솟값을 구하는 프로그램을 작성하시오. */ let n = 10 let k = 4200 let a = [1,5,10,50,100,500,1000,5000,10000,50000] let count = 0 // 동전의 단위 // 예제 결과 6 let i = a.length - 1 // 큰 단위부터 거꾸로 연산 do { if (1 0) // 금액이 0이 되는 순간 끝 console.log(c..
-
항해 99 5기 TIL_39항해 99 2022. 2. 18. 04:05
▶ Today I Learned [k번째 수] 소요 시간: 1시간 20분 해결 여부: 해결 https://programmers.co.kr/learn/courses/30/lessons/42748?language=javascript /*k번째 수 i번째 숫자부터 j번째 숫자까지 자르고 정렬했을 때, k번째에 있는 수를 구하려 합니다. 배열 array, [i, j, k]를 원소로 가진 2차원 배열 commands가 매개변수로 주어질 때, commands의 모든 원소에 대해 앞서 설명한 연산을 적용했을 때 나온 결과를 배열에 담아 return 하도록 solution 함수를 작성해주세요. commands의 각 원소는 길이가 3입니다. */ let array = [1, 5, 2, 6, 3, 7, 4] let com..