Reported June 2026
Luma AImatrix

Build a Gaussian Blur Kernel

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

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

The mistake that sinks a first attempt on this Luma AI question is skipping the normalization step and returning raw exp values. Luma AI reported this OA in June 2026, and it asks you to build a centered k by k Gaussian blur kernel for a given sigma. It's a small matrix-building problem with a numeric trap, not a hard algorithm. If you've got an invite and 48 hours, you can nail this in one pass. And if your head goes blank mid-assessment, StealthCoder runs invisibly on your desktop as a safety net and gives you the solution in real time.

The problem

Return a centered k × k Gaussian blur kernel with standard deviation sigma.
For offsets x,y from the center, use a value proportional to exp(-(x²+y²)/(2·sigma²)), then normalize all entries so their sum is 1.

Function
gaussianKernel(k: int, sigma: double) → double[][]

Examples
Example 1
k = 3
sigma = 1.0
return = [[0.07511360795411151,0.12384140315297397,0.07511360795411151],[0.12384140315297397,0.2041799555716581,0.12384140315297397],[0.07511360795411151,0.12384140315297397,0.07511360795411151]]
The center has the greatest weight and the normalized matrix sums to one.

Constraints
1 <= k <= 31 and k is odd.
0.1 <= sigma <= 20.
Results use absolute tolerance 1e-9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is simple. Compute the center as k//2. For each row i and column j, set x = i - center and y = j - center, then the value is exp(-(x*x + y*y) / (2*sigma*sigma)). Sum every entry as you go, then divide each entry by that total so the matrix sums to 1. Two passes, O(k^2) time. The common pitfalls: normalizing per row instead of globally, using integer division on the center or the exponent, and forgetting that sigma is a double. Don't use the 1/(2*pi*sigma^2) prefactor either. It cancels out in normalization, so skip it. Tolerance is 1e-9, so plain doubles are fine, just don't round early. Check k=1, which must return [[1.0]]. If you freeze on the indexing or the normalization order, StealthCoder is the hedge during the live OA.

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 Build a Gaussian Blur Kernel 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

⏵ The honest play

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

Luma AI 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.

Build a Gaussian Blur Kernel FAQ

How hard is the Luma AI Gaussian blur kernel question really?+

Easy. It's two nested loops and a division. The difficulty is only in remembering to normalize globally and getting the centered offsets right. If you've written any 2D matrix fill before, you can finish this in a few minutes.

What's the trick to getting it right the first time?+

Compute raw weights using exp(-(x^2+y^2)/(2*sigma^2)) with x and y measured from the center index k//2. Keep a running total. Then divide every entry by that total. Normalization must use the sum of the whole matrix, not a row.

Do I need the 1/(2*pi*sigma^2) constant in front?+

No. The problem says the value is proportional to the exponential, then normalized. Any constant factor cancels when you divide by the total. Including it won't break the answer, but it's wasted work and one more place to make a typo.

What edge cases should I test before submitting?+

Test k=1, which should return [[1.0]]. Test the example, k=3 and sigma=1.0, and check the center is 0.2041799555716581. Also try a large sigma like 20 with k=31, where entries are nearly equal, and a tiny sigma like 0.1, where the center dominates.

How do I prepare for this in 48 hours?+

Write the function from scratch twice, once in your OA language. Practice centered-offset loops, floating-point sums, and a normalization pass. Check that the output sums to 1 within 1e-9. That covers this question and most similar matrix-fill problems.

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

OA at Luma AI?
Invisible during screen share
Get it