일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- redux
- react
- useDispatch
- 리액트
- SW
- maeil-mail
- Algorithm
- redux-saga
- programmers
- 항해99
- 테코테코
- JavaScript
- react-router
- 항해플러스
- sw expert academy
- react-redux
- redux-toolkit
- json-server
- 매일메일
- createSlice
- 코딩테스트합격자되기
- java
- Get
- 프로그래머스
- Python
- C++
- axios
- 알고리즘
- 이코테
- 자바
- Today
- Total
목록분류 전체보기 (302)
Binary Journey
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript function solution(s) { const c = s.split(" ").map((n) => +n); return `${Math.min.apply(null, c)} ${Math.max.apply(null, c)}`; } 다른 풀이를 보니 숫자로 변환할 필요가 없었다. 다음은 추천을 가장 많이 받은 풀이다. function solution(s) { const arr = s.split(' '); return Math.min(...arr)+' '+Math.max(...arr); } + 풀이 추가 (2021.12.06) function solution(s) { c..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript function solution(A, B){ const a = A.sort((x, y) => x - y); const b = B.sort((x, y) => y - x); return a.reduce((acc, curr, index) => acc += curr * b[index], 0); } 다른 풀이들을 보니까 모두 같은 생각이었나 보다. 아래는 가장 많은 추천을 받은 풀이다. function solution(A,B){ A.sort((a, b) => a - b) B.sort((a, b) => b - a) return A.reduce((total, val, idx) ..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges 갓택오버플로우 https://stackoverflow.com/questions/47047682/least-common-multiple-of-an-array-values-using-euclidean-algorithm Least Common Multiple of an array values using Euclidean Algorithm I want to calculate the least common multiple of an array of values, using Euclideans algorithm I am using this pseudocode implementation: found o..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript function solution(record) { let answer = []; const users = {}; const records = record.map((r) => r.split(" ")); for (const [order, id, nickName] of records) { if (nickName) users[id] = nickName; } for (const [order, id, nickName] of records) { if (order.startsWith("E")) answer.push(`${users[id]}님이 들어왔습니다.`); if (order..
지난주에 응시했는데 늦게 응시했다. 근데 그렇다고 추천을 많이 받을 만한 신박한 풀이를 제출한 것도 아니었다. 오늘로 1주차 챌린지가 끝났으니 내 풀이를 올려보겠다. 출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges 문제를 보면 등차수열의 합이다. 등차수열의 합 공식을 이용하면 된다. 100 + 200 + 300 .. -> 100 * (1 + 2 + 3 ..) 3 + 6 + 9 + 12... -> 3 * (1 + 2 + 3 ...) 결국 price * 시그마 n 으로 위 이미지에서 첫번째 식을 사용하면 된다. ** Javascript function solution(price, money, count) { const total = pric..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript function solution(n) { return `${n}`.split("").map((s) => parseInt(s)).reverse(); } 혹은 function solution(n) { return `${n}`.split("").map((s) => +s).reverse(); } 정수 내림차순으로 배치하기 문제를 응용하여 (https://binaryjourney.tistory.com/101) 작성한다면 function solution(n) { var nums = []; do{ nums.push(n % 10); n = Math.floor(n / 10); } ..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript 1) 첫번째로 제출한 풀이다. function solution(n) { return parseInt(n.toString().split("").sort((a,b) => b-a).join("")); } 2) 다음 풀이도 가능하다. function solution(n) { return parseInt(n.toString().split("").sort().reverse().join("")); } sort() 메소드와 reverse() 의 경우 기본적으로 string 을 다룬다. 숫자 정렬의 경우 오름차순은 (a, b) => a - b 내림차순은 (a, b) => b- a ..
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript 1) 내 첫식은 이랬다 function solution(arr) { var answer = [ ...arr ]; answer.sort((a, b) => b - a).pop(); return arr.length === 1 ? [-1] : answer; } 테스트 케이스가 적어서 걸리진 않았는데 완벽한 건 아니다. 문제에서는 그냥 제일 작은 수를 제외시키라는 건데 나는 내림차순 정렬까지 한 경우라 조금 어긋난다. 보완한 식은 아래식인데 사실 내가 직접 알고 작성한 건 아니다. 그런데 제출이 아래 풀이로 되어 있다. 통과된 풀이에는 Math 안 썼는데 function s..
https://ziyuun.tistory.com/5 프로그래머스_방의개수_49190 문제 링크 조건 (0,0)에서 시작, 8방으로 이동 가능 arrows : 이동 방향을 담은 배열 (길이 1 ~ 100,000 | 범위 0 ~ 7) 방은 다른 방으로 둘러 싸여질 수 있음 접근 방법 최대 10만번 이동이 가능 => col, row 최 ziyuun.tistory.com https://coding-insider.tistory.com/entry/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-5-%EB%B0%A9%EC%9D%98-%EA%B0%9C%EC%88%98-CC-%E2%98%85%E2%98%85%E2%98%85 [프로그래머스 5] 방의 개수 (C/C++) (..
https://www.inflearn.com/course/algorithm-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EC%8B%A4%EC%8A%B5#curriculum [무료] 알고리즘의 개요와 실습 환경 구축 - 인프런 | 강의 알고리즘을 배우며, 실무에서는 알고리즘이 어떻게 활용되는지 알아봅니다., [임베딩 영상] 알고리즘의 개요와 실습 환경 구축 알고리즘은 문제를 해결하는 절차입니다.입력, 출력, 유한성, 명 www.inflearn.com 11강 힙 정렬에 대한 리뷰이다. 9, 10강은 C++ 라이브러리에 관한 내용이라 리뷰를 따로 다루지 않겠다. 1. 소스코드 ** C++ 아래는 강의에서 작성해본 C++ 소스이다. #include int number = 9; int he..