Reported September 2026
Freshworksprefix sum

Product Of Array Except Self

Reported by candidates from Freshworks's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Freshworks OA. Under 2s to a working solution.
Founder's read

Freshworks reported this one in September 2026, and it's a classic: Product Of Array Except Self. The whole solution hinges on a plain array used twice, once for prefix products and once for suffix products. If your OA invite lands in the next day or two, this is a problem worth recognizing on sight. No division allowed, and zeros are in the examples on purpose. Most people who fail it reach for division, hit the zero case, and panic. If you blank during the live assessment, StealthCoder runs invisibly on your desktop and gives you the approach in real time. But you can learn this one in ten minutes.

The problem

You are given an integer array nums of length n.
Return an array answer of the same length where answer[i] is the product of every value in nums except nums[i].
The product of any prefix or suffix of nums fits in a 32-bit integer. Do not use the division operator.

Function
productExceptSelf(nums: int[]) → int[]

Examples
Example 1
nums = [1,2,3,4]
return = [24,12,8,6]
The products excluding each index are 2*3*4, 1*3*4, 1*2*4, and 1*2*3.
Example 2
nums = [-1,1,0,-3,3]
return = [0,0,9,0,0]
A single zero makes every other product zero. The product excluding that zero is -1*1*-3*3 = 9.

Constraints
2 <= nums.length <= 10^5.
-30 <= nums[i] <= 30.
The product of any prefix or suffix of nums fits in a 32-bit integer.
Every output value answer[i] also fits in a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is two passes over the array. First pass, left to right: answer[i] holds the product of everything before index i, starting with 1. Second pass, right to left: keep a running suffix product, multiply it into answer[i], then fold nums[i] into the suffix. That gives O(n) time and O(1) extra space beyond the output. The common pitfall is dividing the total product by nums[i], which the problem bans and which breaks on zeros anyway. The second pitfall is initializing the prefix to 0 instead of 1, which zeroes everything. Check Example 2 by hand: one zero means only the zero's own slot gets a nonzero value. If you freeze in the live OA, StealthCoder is the safety net that shows the two-pass structure, but trace [1,2,3,4] once and you won't need it.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Product Of Array Except Self cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as product of array except self. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Freshworks's OA.

Freshworks reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Product Of Array Except Self FAQ

What's the trick for Product Of Array Except Self?+

Build prefix products in one pass and suffix products in another. answer[i] equals the product of everything left of i times everything right of i. Store prefixes directly in the output array, then sweep right to left with a running suffix variable. No division needed.

How hard is this one really?+

Medium, but it's a known pattern. Once you see prefix and suffix products, the code is about ten lines. The difficulty is realizing division is out and handling zeros. Freshworks reported it in September 2026, so expect the standard version with little twist.

Why can't I just divide the total product by nums[i]?+

The problem forbids division, and zeros break it anyway. If nums contains a zero, the total product is 0 and you'd divide by zero at that index. Example 2 exists to catch exactly this mistake. Prefix and suffix products handle zeros naturally.

Can I do it in O(1) extra space?+

Yes, not counting the output array. Fill the output with prefix products first. Then walk right to left with one integer holding the suffix product, multiplying it into each slot and updating it with nums[i]. Interviewers often ask for this follow-up.

How do I prepare for this in 48 hours?+

Write the two-pass solution from memory twice. Trace [1,2,3,4] and [-1,1,0,-3,3] by hand, checking the zero case. Then write the same logic with separate left and right arrays first, and collapse them into one. That covers every variant you're likely to see.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Freshworks.

OA at Freshworks?
Invisible during screen share
Get it