class Solution {
public int solution(int[] num_list) {
int answer = 0;
return answer;
}
}
class Solution {
public int solution(int[] num_list) {
int answer = 0;
String odd = "", even = "";
for (int i = 0; i < num_list.length; i++ ) {
if (num_list[i] % 2 == 1) {
odd += num_list[i];
} else {
even += num_list[i];
}
}
answer = Integer.parseInt(odd) + Integer.parseInt(even);
return answer;
}
}
string 타입으로 선언하기
Integer.parseInt()
class Solution {
public int solution(int[] num_list) {
int answer = 0;
String even = "";
String odd = "";
for (int i : num_list) {
if (i % 2 == 0) {
even += i;
} else {
odd += i;
}
}
answer = Integer.parseInt(even) + Integer.parseInt(odd);
return answer;
}
}