Reported July 2026
New Relicarray

Product of Array Except Self

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

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

Brute force on Product of Array Except Self is O(n^2), and the New Relic OA reported in July 2026 wants you to skip it from the first minute. The interviewer asked for the most optimized solution up front, then had the candidate run two test cases. No division allowed, so the easy shortcut is gone. It's an array problem with a prefix and suffix trick. If your brain locks up under the clock, StealthCoder is the invisible safety net running on your screen during the live OA. Know the trick first, though.

The problem

Given an integer array nums, return an array answer where answer[i] is the product of every element of nums except nums[i].
Do not use division.
Interview Follow-up
The interviewer asked for the most optimized solution from the start and then had the candidate run two test cases.

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

Examples
Example 1
nums = [1,2,3,4]
return = [24,12,8,6]
Each position contains the product of all values except the one at that position.
Example 2
nums = [-1,1,0,-3,3]
return = [0,0,9,0,0]
Only the index containing 0 receives the product of all nonzero values.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: answer[i] equals the product of everything left of i times the product of everything right of i. Do one pass left to right, storing the running prefix product in the output array. Then do a second pass right to left with a single running suffix variable, multiplying it into each slot. That's O(n) time and O(1) extra space beyond the output. The common pitfall is allocating two full arrays and then being asked for the optimized version anyway. Another is mishandling zeros. Example 2, [-1,1,0,-3,3], returns [0,0,9,0,0], and the prefix/suffix approach handles that naturally with no special casing. Trace both examples by hand before you submit, since the interviewer ran two test cases. If you blank mid-assessment, StealthCoder can surface the two-pass solution while you keep typing and talking.

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

New Relic 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 without division?+

Use prefix and suffix products. First pass fills each output slot with the product of everything to its left. Second pass walks right to left with a running suffix variable and multiplies it in. Two loops, O(n) time, no division needed.

How hard is this problem really?+

Medium on paper, easy once you've seen the two-pass idea. The hard part is thinking of it under pressure. Brute force is obvious, but New Relic's reported version asked for the most optimized solution from the start, so don't plan to refine later.

How do zeros affect the answer?+

With the prefix/suffix method, you don't special-case them. One zero makes every other position zero, and that index gets the product of the rest. Example 2 shows this: [-1,1,0,-3,3] gives [0,0,9,0,0]. Two zeros make everything zero.

Can I get O(1) extra space?+

Yes, not counting the output array. Store prefix products directly in the result, then sweep from the right with one running suffix integer. Interviewers usually mean this when they say most optimized. Mention the space tradeoff out loud.

How do I prepare in 48 hours for this OA?+

Write the two-pass solution from memory twice. Then hand-trace both examples, including the zero case, and check negative numbers. The interview reportedly included running two test cases, so practice narrating your trace clearly and catching off-by-one errors in loop bounds.

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

OA at New Relic?
Invisible during screen share
Get it