Reported September 2026
Infosysprefix sum

Product Of Array Except Self

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

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

The Infosys OA reported in September 2026 hands you Product Of Array Except Self, and the whole thing hinges on one plain array used twice. No hash map, no fancy structure. Just the output array doing double duty as storage for running products. The catch is the rule: no division. That kills the lazy answer and forces the prefix/suffix idea. If you've seen this one, it's a ten-minute problem. If you haven't, it can eat your whole clock. StealthCoder sits invisibly on your screen during the live OA as a safety net if your mind goes blank on the approach.

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 prefix and suffix products. For each index i, answer[i] equals the product of everything to its left times the product of everything to its right. Do it in two passes. First pass left to right: set answer[i] to the running product of elements before i, starting at 1. Second pass right to left: keep a running suffix product, multiply it into answer[i], then fold nums[i] into the suffix. That's O(n) time and O(1) extra space beyond the output. The common pitfall is reaching for division, which the problem bans and which breaks on zeros anyway. Example 2 shows it: one zero makes every other product zero. Another miss is forgetting to start both running products at 1. If you blank on the two-pass structure in the live OA, StealthCoder is the hedge that gets you the clean version fast.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

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 for the candidate who got the OA invite this morning and has 72 hours, not six months.

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 Infosys's OA.

Infosys reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Product Of Array Except Self FAQ

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

Use prefix and suffix products. Pass one stores the product of everything left of each index in the output array. Pass two walks right to left with a running suffix product and multiplies it in. No division needed, and it runs in linear time.

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

The problem bans division outright. Even if it didn't, zeros break it. The total product becomes 0, and dividing by a zero element is undefined. Example 2 with [-1,1,0,-3,3] is exactly that case. Prefix and suffix products handle zeros without special casing.

How hard is this really for the Infosys OA?+

It's a medium that feels easy once you know the pattern. The code is about ten lines. Infosys reported it in September 2026. The risk is not difficulty, it's freezing on the no-division constraint and wasting time on brute force.

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

Yes, if the output array doesn't count as extra space. Fill it with left products first. Then loop from the right with one running suffix variable and multiply it into each slot. You only need that one variable besides the output.

How do I prep for this in 48 hours?+

Write the two-pass solution from scratch twice. Then trace Example 2 by hand to see how the zero propagates. Check edge cases: length 2, negatives, and a single zero. After that, move on and review similar prefix-based array problems instead of re-reading this one.

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

OA at Infosys?
Invisible during screen share
Get it