LeetCode 625, Medium. Topics: Greedy, Math, Prime Factorization. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 14 parametrized pytest cases, and a playground notebook:
Problem
Given a positive integer num, return the smallest positive integer x whose multiplication of each digit equals num. If there is no answer or the answer is not fit in 32-bit signed integer, return 0.
Examples
Constraints
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode All. Last modified on September 7, 2026