Prime with 3 Factors Problem Statement
You are provided with an array ARR
consisting of 'N' positive integers. Your task is to determine if each number in the array ARR
has exactly 3 factors.
You need to return an array with '0' and '1', where '0' means that ARR[index]
does not have exactly 3 factors, and '1' means ARR[index]
indeed has exactly 3 factors.
Example:
Input:
N = 4, ARR = [3, 5, 4, 2]
Output:
[0, 0, 1, 0]
Explanation:
For the given input,
- 3 has factors: 1, 3 (2 factors).
- 5 has factors: 1, 5 (2 factors).
- 4 has factors: 1, 2, 4 (3 factors).
- 2 has factors: 1, 2 (2 factors).
Hence, the resulting array is [0, 0, 1, 0]
.
Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 106
1 < ARR[index] ≤ 1012
- Time Limit: 1 second

AnswerBot
4mo
Determine if each number in the array has exactly 3 factors.
Iterate through each number in the array and check if it has exactly 3 factors.
Factors of a number can be found by iterating from 1 to the s...read more
Help your peers!
Add answer anonymously...
Adobe Software Developer Intern interview questions & answers
A Software Developer Intern was asked Q. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more
Popular interview questions of Software Developer Intern
A Software Developer Intern was asked Q1. Unbounded Knapsack Problem Statement Given ‘N’ items, each with a specific profi...read more
A Software Developer Intern was asked Q2. Minimum Cost to Make String Valid Given a string containing only '{' and '}', de...read more
A Software Developer Intern was asked Q3. Digit Count In Range Problem Statement Given an integer K, and two numbers A and...read more
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

