Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Product of Array Except Self
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given an array, return an array where each element is the product of all other elements except itself.
Sample Input:
[1,2,3,4]
Sample Output:
[24,12,8,6]
Hints
Hint 1
Calculate prefix products from left to right
Hint 2
Calculate suffix products from right to left
Hint 3
Multiply prefix and suffix for each position
Code Editor
Reset
Run
Save
Loading...