834. Prime factorisation of a Number
You are given an integer array queries of length n.
Return the prime factorization of each number in array queries in sorted order.
Example 1:
Input : queries = [2, 3, 4, 5, 6]
Output : [ [2], [3], [2, 2], [5], [2, 3] ]
Explanation : The values 2, 3, 5 are itself prime numbers.
The prime factorization of 4 will be --> 2 * 2.
The prime factorization of 6 will be --> 2 * 3.
Example 2:
Input : queries = [7, 12, 18]
Output : [ [7], [2, 2, 3], [2, 3, 3] ]
Explanation : The value 7 itself is a prime number.
The prime factorization of 12 will be --> 2 * 2 * 3.
The prime factorization of 18 will be --> 2 * 3 * 3.
Now Your Turn!
Pick the correct output for the given inputInput : queries = [15, 20]
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 <= 105
- 2 <= queries[i] <= 2*105