803. Factors of a Given Number
Given a natural number n, return a list of all distinct positive integers that are factors (divisors) of n in increasing order.
Example 1:
Input: n = 6Â Â
Output: [1, 2, 3, 6]Â Â
Explanation: 6 is divisible by 1, 2, 3, and 6.
Example 2:
Input: n = 9Â Â
Output: [1, 3, 9]Â Â
Explanation: 9 is divisible by 1, 3, and 9.
Now Your Turn!
Pick the correct output for the given inputInput: n = 28Â Â
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 109
- The output must be in increasing order
- You must not use extra space proportional to n