[프로그래머스 자바] 16. 두 수의 연산 값 비교하기

김건우's avatar
Apr 06, 2025
[프로그래머스 자바] 16. 두 수의 연산 값 비교하기

문제

notion image

내가 푼 코드

notion image
class Solution { public int solution(int a, int b) { // 1. 이어 붙인 값 (a ⊕ b) int c = Integer.parseInt(String.valueOf(a) + String.valueOf(b)); // 2. 두 수를 곱한 후 2배 int d = 2 * a * b; // 3. 조건에 따라 결과 반환 return Math.max(c, d); } }
Share article

gunwoo