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
- greedy
- 파이썬
- string
- sorting
- Stack
- dynamic programming
- Binary Tree
- Binary Search
- bit manipulation
- hash table
- database
- geometry
- 자바
- array
- Method
- 구현
- Number Theory
- Matrix
- two pointers
- Math
- Tree
- simulation
- 코테
- Counting
- Data Structure
- java
- SQL
- Class
- 코딩테스트
- implement
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 외계행성의 나이 본문
1. Input
1) 나이 age
2. Output
1) 외계행성식 나이
2) 0은 a, 1은 b, ..., 9는 j로 표현
3. Constraint
1) age는 자연수
2) age <= 1000
3) 외계행성식 나이는 알파벳 소문자만 사용
4. Example
Input: age=23 -> Output: “cd”
5. Code
1) 첫 코드(2022/10/21)
String n = age + "";
String answer = "";
// '0'=48, 'a'=97인 것을 이용
for(int i=0 ; i<n.length() ; i++)
answer += (char)(n.charAt(i)+49) + "";
return answer;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 진료순서 정하기 (0) | 2022.10.21 |
---|---|
[프로그래머스/Lv.0] 순서쌍의 개수 (0) | 2022.10.21 |
[프로그래머스/Lv.0] 배열 자르기 (0) | 2022.10.21 |
[프로그래머스/Lv.0] 짝수의 합 (0) | 2022.10.21 |
[프로그래머스/Lv.0] 양꼬치 (0) | 2022.10.21 |