File tree 1 file changed +0
-24
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 1281. Subtract the Product and Sum of Digits of an Integer
5
- *
6
- * Given an integer number n, return the difference between the product of its digits and the sum of its digits.
7
- *
8
- * Example 1:
9
- * Input: n = 234
10
- * Output: 15
11
- * Explanation:
12
- * Product of digits = 2 * 3 * 4 = 24
13
- * Sum of digits = 2 + 3 + 4 = 9
14
- * Result = 24 - 9 = 15
15
- *
16
- * Example 2:
17
- * Input: n = 4421
18
- * Output: 21
19
- * Explanation:
20
- * Product of digits = 4 * 4 * 2 * 1 = 32
21
- * Sum of digits = 4 + 4 + 2 + 1 = 11
22
- * Result = 32 - 11 = 21
23
- *
24
- * Constraints:
25
- * 1 <= n <= 10^5
26
- * */
27
3
public class _1281 {
28
4
public static class Solution1 {
29
5
public int subtractProductAndSum (int n ) {
You can’t perform that action at this time.
0 commit comments