코딩테스트/프로그래머스 Lv.0
[코테/0레벨] 더 크게 합치기
moca7
2025. 2. 23. 17:40
ㅁ 내 풀이
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;
}
}