class Solution {
public int solution(int a, int b) {
String ex1 = ""+a+b;
String ex2 = ""+b+a;
int a1 = Integer.parseInt(ex1);
int a2 = Integer.parseInt(ex2);
if (a1>=a2) return a1;
else return a2;
}
}
Integer.valueOf()로 변경해서 풀이 가능
[다른 사람 풀이]
class Solution {
public int solution(int a, int b) {
String strA = String.valueOf(a);
String strB = String.valueOf(b);
String strSum1 = strA + strB;
String strSum2 = strB + strA;
return Math.max(Integer.valueOf(strSum1), Integer.valueOf(strSum2));
}
}
class Solution {
public int solution(int a, int b) {
int answer = 0;
int aLong = Integer.parseInt(""+a+b);
int bLong = Integer.parseInt(""+b+a);
answer = aLong > bLong ? aLong : bLong;
return answer;
}
}