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 |
Tags
- 유클리드 호제법
- algorithm
- 데이터타입
- IaaS
- valueof
- 11652
- parseInt
- 프로그래머스
- 최대공배수
- 최대공약수
- aws
- 11004
- SaaS
- INT
- 2진수
- 백준
- PaaS
- 알고리즘
- java
- 자료형
- IntelliJ
- 프로젝트 생성
- 리스트
- level1
- Python
- 홀수
- 짝수
- 온프레미스
- 웹 서버
- 문자열 숫자 변환
Archives
- Today
- Total
Ga0Lee
[알고리즘] 프로그래머스(Level 1) - 3진법 뒤집기(Java) 본문
class Solution{
public int solution(int n){
int answer = 0;
String temp = "";
while(n!=0){
int num = n%3;
temp += Integer.toString(num);
n /= 3;
}
answer = Integer.parseInt(temp, 3);
return answer;
}
}
'Algorithm' 카테고리의 다른 글
[Python] 파이썬 리스트 중복 제거 (0) | 2023.08.30 |
---|---|
[알고리즘] 거스름돈 동전의 최소 개수 구하기 - 그리디 알고리즘, 탐욕 알고리즘 (0) | 2023.08.08 |
[알고리즘] 프로그래머스(Level 1) - 가운데 글자 가져오기 (0) | 2022.07.16 |
[알고리즘] 프로그래머스(Level1) - 수박수박수박수박수?(Java) (0) | 2022.06.19 |
[알고리즘] 프로그래머스(Level1) - 약수의 합(Java) (0) | 2022.06.18 |