
Asked in Protium Finance
Prime Factorization Problem Statement
Given several queries each containing a single integer 'N', the task is to find the prime factorization of each integer using a sieve method.
Example:
Input:
N = 12
Output:
2 2 3
Input:
The first line contains a single integer ‘T’, representing the number of test cases.
The first line of each test case contains a single integer 'Q', representing the number of queries.
The second line of each test case will contain 'Q' space-separated integers, representing the integers whose prime factorization you have to find.
Output:
For each test case, print all the prime factors of 'N' in a single line separated by a single space.
Output for each query will be printed in a separate line.
The order of the output for each query doesn't matter.
Output for each test case will be printed in a separate line.
Constraints:
1 <= T <= 5
1 <= Q <= 10^5
2 <= N <= 10^6
- Time Limit: 1 sec.
Note
You are not required to print anything; it has already been taken care of. Just implement the function and return the answer.

AnswerBot
1y
The task is to find the prime factorization of given integers using a sieve.
Implement a function to find the prime factors of each integer using a sieve algorithm.
Use the given input format to read th...read more
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Protium Finance
Q. Search In Rotated Sorted Array Problem Statement Given a sorted array of distinc...read more
Q. What is the garbage collector in Java?
Q. What is the difference between an abstract class and an interface in Object-Orie...read more
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Protium Finance Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

