Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- programmers
- SW
- 코딩테스트합격자되기
- 항해99
- Get
- C++
- 알고리즘
- json-server
- react-redux
- 자바
- redux-saga
- Python
- react
- 이코테
- sw expert academy
- createSlice
- Algorithm
- 프로그래머스
- 리액트
- axios
- useDispatch
- redux
- react-router
- 테코테코
- 매일메일
- 항해플러스
- maeil-mail
- JavaScript
- java
- redux-toolkit
Archives
- Today
- Total
목록124의나라 (1)
Binary Journey
[프로그래머스] 프로그래머스 124 나라의 숫자
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges ** Javascript 3진법이라는 알았는데 for문으로 접근했다가 시간을 너무 오래 잡아먹었다. 결국 구글링해서 답을 알아냈는데 생각보다 더 간단했다. while 을 사용하면 이렇고 function solution(n) { const availableNumber = [ 4, 1, 2 ]; let answer = ''; while (n) { answer = availableNumber[n % 3] + answer; n = n % 3 ? Math.floor(n / 3) : n / 3 - 1; } return answer; } 더 줄이면 이렇게 된다. 추천 가장 많이 받은 식인데 재귀함수 방..
프로그래머스/level 2
2021. 4. 22. 21:52