JAVA_LeetCode 1281_Subtract the Product and Sum of Digits of an Integer


JAVA_LeetCode 1281_Subtract the Product and Sum of Digits of an Integer

JAVA_LeetCode 1281_Subtract the Product and Sum of Digits of an Integer 풀이 class Solution { public int subtractProductAndSum(int n) { int sum = 0, mul = 1; // 한자리씩 체크하면서 곱/합에 따라 값을 곱/더한다. while (n > 0){ mul *= (n % 10); sum += (n % 10); n = (n / 10); } return mul -sum; } } * 출처 https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer...

JAVA_LeetCode 1281_Subtract the Product and Sum of Digits of an Integer에 대한 요약내용입니다.

자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.


#JAVA #JAVA_LeetCode1281 #JAVA_LeetCode1281_SubtracttheProductandSumofDigitsofanInteger #JAVA_SubtracttheProductandSumofDigitsofanInteger #LeetCode1281_SubtracttheProductandSumofDigitsofanInteger

원문링크 : JAVA_LeetCode 1281_Subtract the Product and Sum of Digits of an Integer