로딩
요청 처리 중입니다...

JAVA_LeetCode 3536_Maximum Product of Two Digits

 JAVA_LeetCode 3536_Maximum Product of Two Digits

JAVA_LeetCode 3536_Maximum Product of Two Digits 풀이 class Solution { public int maxProduct(int n) { // 리스트에 각 수를 담고 정렬한다음, 가장 맨뒤와 그 전 값을 곱해준다. ArrayList list = new ArrayList(); int len = 0; while(n !

= 0){ list.add(n % 10); n /= 10; } Collections.sort(list); len = list.size(); return list.get(len - 1) * list.get(len - 2); } } * 출처 https://leetcode.com/problems/maximum-product-of-two-digits...