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
2mo
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
3mo
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 4d agoQ. What are the concepts of Object-Oriented Programming (OOP)?
A Project Engineer was asked 1w agoQ. What are dictionary attributes?
A Project Engineer was asked 1w agoQ. What is the dictionary override rule?
Popular interview questions of Project Engineer
A Project Engineer was asked 4d agoQ1. What are the concepts of Object-Oriented Programming (OOP)?
A Project Engineer was asked 4d agoQ2. In which scenarios can constructors be utilized?
A Project Engineer was asked 1w agoQ3. What is the dictionary override rule?
Top HR questions asked in Wipro Project Engineer
A Project Engineer was asked 1mo agoQ1. Tell me about your final year project.
A Project Engineer was asked 1mo agoQ2. Would you prefer to work as a team leader or a team member?
A Project Engineer was asked 1mo agoQ3. Tell me about your favorite subject in college.
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app