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
- 자바
- Mendix
- Sort
- microflow
- 스택
- 멘딕스
- 알고리즘
- git
- 자료구조
- 반효경교수님
- domain model
- MySQL
- 가중치없는그래프
- 그래프
- 트리
- 해시맵
- 완전탐색
- 정렬
- 재귀
- lcap
- SQL
- 이분탐색
- algorithm
- dfs
- Recursion
- 집합
- 프로그래머스
- 매개변수 탐색
- 백트래킹
- Bruteforce
Archives
- Today
- Total
728x90
목록3진법 (1)
mondegreen
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/oXrJR/btsGH3UY0P1/mNYJgdzMxzKpRi6Xauesp0/img.png)
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