Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

Subtract the Product and Sum of Digits of an Integer

Easy

Topics
Math

Given an integer n, return the product of its digits minus the sum of its digits.

Example 1

Input:  n = 234
Output: 15
Explanation: product = 24, sum = 9, 24 - 9 = 15.

Example 2

Input:  n = 4421
Output: 21

Constraints

  • 1 <= n <= 10^5
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access