ㅁ 내 풀이
class Solution {
public int solution(int a, int b) {
int first = Integer.parseInt(String.valueOf(a) + String.valueOf(b));
int second = Integer.parseInt(String.valueOf(b) + String.valueOf(a));
return first>second ? first : second;
}
}
ㅁ 다른 풀이
class Solution {
public int solution(int a, int b) {
int first = Integer.parseInt("" + a + b);
int second = Integer.parseInt("" + b + a);
return first>second ? first : second;
}
}
'코딩테스트 > 프로그래머스 Lv.0' 카테고리의 다른 글
[코테/0레벨] 문자열 붙여서 출력하기 (0) | 2025.02.23 |
---|---|
[코테/0레벨] n의 배수 (0) | 2025.02.23 |
[코테/0레벨] 이어 붙인 수 (0) | 2025.02.23 |
[코테/0레벨] 두 수의 연산값 비교하기 (0) | 2025.02.11 |
[코테/0레벨] 0 떼기 (0) | 2025.02.11 |