Product Of Array Except Self Problem Statement
You are provided with an integer array ARR
of size N
. You need to return an array PRODUCT
such that PRODUCT[i]
equals the product of all the elements of ARR
except ARR[i]
.
Example:
Input:
T = 2
N = 4
ARR = [1, 2, 3, 4]
N = 3
ARR = [2, 3, 4]
Output:
[24, 12, 8, 6]
[12, 8, 6]
Constraints:
1 ≤ T ≤ 100
0 ≤ N ≤ 105
0 ≤ ARR[i] ≤ 105
- Time Limit: 1 sec
Note:
Each product may exceed integer limits, so take modulo MOD = 109 + 7
to keep results in bounds.
Follow Up:
Can you solve the problem using O(1) additional space?

AnswerBot
4mo
The problem requires returning an array where each element is the product of all elements in the input array except itself.
Iterate through the array twice to calculate the product of all elements to t...read more
Help your peers!
Add answer anonymously...
Accenture Data Engineering Analyst interview questions & answers
A Data Engineering Analyst was asked 9mo agoQ. Can you explain your academic projects?
A Data Engineering Analyst was asked Q. Suppose you are adding a block that takes a significant amount of time. How woul...read more
A Data Engineering Analyst was asked Q. Explain Airflow and its internal architecture.
Popular interview questions of Data Engineering Analyst
A Data Engineering Analyst was asked 9mo agoQ1. Can you explain your academic projects?
A Data Engineering Analyst was asked Q2. Suppose you are adding a block that takes a significant amount of time. How woul...read more
A Data Engineering Analyst was asked Q3. Explain Airflow and its internal architecture.
>
Accenture Data Engineering Analyst Interview 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

