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 | 29 | 30 | 31 |
Tags
- dfs
- 멘딕스
- 가중치없는그래프
- 백트래킹
- git
- 재귀
- 자바
- microflow
- SQL
- MySQL
- 자료구조
- 완전탐색
- 알고리즘
- lcap
- Bruteforce
- Recursion
- 이분탐색
- 프로그래머스
- 매개변수 탐색
- 스택
- Mendix
- 정렬
- 집합
- Sort
- algorithm
- 그래프
- 트리
- 해시맵
- domain model
- 반효경교수님
Archives
- Today
- Total
728x90
목록3진법 (1)
mondegreen

10진법의 수를 3진법으로 바꾸며 나머지는 진법의 수로 몫은 0이 될 때까지 다시 나누는 몫으로 처리하여 구한다. 기존 3진법의 0,1,2 대신 1,2,4를 쓰는 방식의 풀이이다. import java.util.*; class Solution { public String solution(int n) { StringBuilder sb = new StringBuilder(); while(n > 0){ int remainder = n % 3; if(remainder == 0) sb.insert(0, "4"); else if(remainder == 1) sb.insert(0, "1"); else if(remainder == 2) sb.insert(0, "2"); n = (n - 1) / 3; } return s..
알고리즘 풀이 및 리뷰/프로그래머스
2024. 4. 17. 10:13
728x90