MEDIUMasked at 1 company

Minimum Factorization

A medium-tier problem at 34% community acceptance, tagged with Math, Greedy. Reported in interviews at Tencent and 0 others.

Founder's read

Minimum Factorization is a tricky greedy problem that sounds simple but catches candidates who jump straight to brute force. You're given a number and need to return the smallest number whose digits multiply to that value. Tencent asks this. The 33% acceptance rate tells you most people get stuck on edge cases or don't realize greedy digit selection works. If you haven't seen the pattern before and it hits your live assessment, StealthCoder surfaces the working solution invisibly while you're screen-sharing.

Companies asking
1
Difficulty
MEDIUM
Acceptance
34%

Companies that ask "Minimum Factorization"

If this hits your live OA

Minimum Factorization is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The trick is greedy selection starting from the largest possible digit (9 down to 2) and dividing the target as much as possible at each step. Most candidates try to build a result recursively or waste time on factorization. The real insight: if you can't reduce the target below 2, there's no valid answer. If the target is 0 or 1, return it directly. Otherwise, keep pulling out 9s, 8s, 7s and so on until the target becomes 1. The digits you extract form your answer in reverse order. Common pitfall: trying to find a single factorization path instead of greedily picking the largest digit at each stage. That costs you time and often produces a suboptimal result. When the greedy choice fails and you haven't drilled this pattern, StealthCoder runs the correct solution live.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Minimum Factorization recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Factorization interview FAQ

Is greedy guaranteed to work on this problem?+

Yes. By always extracting the largest possible digit (9 down to 2), you minimize the result's length and digit count. Any other order produces a larger number. The math checks out once you see it, but it's not obvious at first glance.

What happens if the target number can't be factored into single digits?+

Return -1. If after exhausting all 2-9 factors the target is still greater than 1, there's no valid answer. This edge case trips up half the failed submissions.

How does this relate to Math and Greedy topics?+

Math covers factorization and divisibility checks. Greedy is the strategy: pick the largest digit that divides the remaining target, then recurse. Understanding both topics separately helps, but the combination is what makes this medium-difficulty.

Is this still asked at top companies?+

Tencent reports it, and it's the kind of problem that shows up in coding assessments more than take-home rounds. The low acceptance rate suggests it's not a warmup. It tests both math intuition and greedy reasoning.

What's the time complexity and does it matter?+

O(log n) for the factorization loop because the target shrinks by at least a factor of 2 each iteration. Space is O(log n) for the output digits. Interview won't judge you on complexity optimization here. Correctness and handling edge cases matter more.

Want the actual problem statement? View "Minimum Factorization" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.