Given an integer n, return the product of its digits. Ignore the sign of the number (use its absolute value). If any digit is zero, the product is zero.

Examples:

Input: n = 234 Output: 24 Explanation: 2 * 3 * 4 = 24 Input: n = 10 Output: 0 Explanation: 1 * 0 = 0 Input: n = 5 Output: 5 Explanation: A single digit number returns itself Input: n = 999 Output: 729 Explanation: 9 * 9 * 9 = 729 Input: n = -25 Output: 10 Explanation: Use the absolute value, so 2 * 5 = 10
Apex Code Editor

Welcome to Lightning Challenge!

How It Works

  • • Write your solution in the code editor
  • • Connect your Salesforce org to test
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 #CodeEveryDay November 2026 (Nov 1–15)Sponsored by FLXBL

Contest runs November 1 - 15. Complete challenges to climb the leaderboard!

Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes

Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In