Tap here to switch tabs
Problem
Submissions

Problem: Balanced K-Factor Decomposition

med
30 min
Try to solve the Balanced K-Factor Decomposition problem.

Statement

Given two integers n and k, find a decomposition of n into k positive integers such that their product is equal to n.

Among all possible decompositions, choose the one that minimizes the difference between the maximum and minimum elements.

Return the k integers sorted in non decreasing order. If there are multiple valid answers, you may return any of them.

Constraints:

  • 4≤4 \leq n ≤105\leq 10^5

  • 2≤2 \leq k ≤5\leq 5

  • k is strictly less than the total number of positive divisors of n.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Balanced K-Factor Decomposition

med
30 min
Try to solve the Balanced K-Factor Decomposition problem.

Statement

Given two integers n and k, find a decomposition of n into k positive integers such that their product is equal to n.

Among all possible decompositions, choose the one that minimizes the difference between the maximum and minimum elements.

Return the k integers sorted in non decreasing order. If there are multiple valid answers, you may return any of them.

Constraints:

  • 4≤4 \leq n ≤105\leq 10^5

  • 2≤2 \leq k ≤5\leq 5

  • k is strictly less than the total number of positive divisors of n.