Mindbending Product Problem Statement
You are given an array ARR
of size N
. Your task is to create a Product Array P
of the same size such that P[i]
is the product of all the elements in ARR
except ARR[i]
. Note that you are not allowed to use the division operator.
Example:
Input:
ARR = [1, 2, 3, 4, 5]
Output:
[120, 60, 40, 30, 24]
Explanation:
The Product Array is created as follows:
P[0] = 2 * 3 * 4 * 5 = 120
P[1] = 1 * 3 * 4 * 5 = 60
P[2] = 1 * 2 * 4 * 5 = 40
P[3] = 1 * 2 * 3 * 5 = 30
P[4] = 1 * 2 * 3 * 4 = 24
Constraints:
1 ≤ T ≤ 50
1 ≤ N ≤ 10
1 ≤ ARR[i] ≤ 20
- Time Limit: 1 sec

AnswerBot
4mo
Create a product array from given array without using division operator.
Iterate through the array twice to calculate products from left and right side of each element.
Multiply left and right products ...read more
Satyam Kashyap
5mo
You have to construct a Product Array 'P' of the same size such that P[i] is equal to the product of all the elements of ARR except ARR[i]. The .
Help your peers!
Add answer anonymously...
Wipro Project Engineer interview questions & answers
A Project Engineer was asked 1w agoQ. Explain the logic behind determining if a number is prime.
A Project Engineer was asked 1w agoQ. What is the need for using Salesforce?
A Project Engineer was asked 1mo agoQ. Why have you not included C and C++ in your resume, considering you are a comput...read more
Popular interview questions of Project Engineer
A Project Engineer was asked 6d agoQ1. Explain the logic behind determining if a number is prime.
A Project Engineer was asked 4w agoQ2. Why have you not included C and C++ in your resume, considering you are a comput...read more
A Project Engineer was asked 1mo agoQ3. Explain Interface with an example.
Top HR questions asked in Wipro Project Engineer
A Project Engineer was asked 2mo agoQ1. What challenges did you face while working on the minor project?
A Project Engineer was asked 2mo agoQ2. Tell me about your final year project.
A Project Engineer was asked 2mo agoQ3. Would you prefer to work as a team leader or a team member?
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

