254. Factor Combinations
Description
Numbers can be regarded as the product of their factors.
- For example,
8 = 2 x 2 x 2 = 2 x 4
.
Given an integer n
, return all possible combinations of its factors. You may return the answer in any order .
Note that the factors should be in the range [2, n - 1]
.
Example 1:
1 | Input: n = 1 |
Example 2:
1 | Input: n = 12 |
Example 3:
1 | Input: n = 37 |
Constraints:
1 <= n <= 10^7
Hints/Notes
- 2025/04/09 Q3
- backtracking
- Leetcode solution
Solution
Language: C++
1 | class Solution { |