-
1281. Subtract the Product and Sum of Digits of an Integer javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 21:05
https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/
class Solution { public int subtractProductAndSum(int n) { int producted = 1; int added = 0 ; int tmp_num = -1; while (n != 0) { tmp_num = n % 10; n /= 10; producted *= tmp_num; added += tmp_num; } return producted - added; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
1779. Find Nearest Point That Has the Same X or Y Coordinate java (0) 2022.09.19 976. Largest Perimeter Triangle java (0) 2022.09.19 191. Number of 1 Bits java (1) 2022.09.19 1491. Average Salary Excluding the Minimum and Maximum Salary python java (1) 2022.09.19 1523. Count Odd Numbers in an Interval Range python java (1) 2022.09.19