FastPrepBuild a Gaussian Blur Kernel
Problems/Build a Gaussian Blur Kernel

Build a Gaussian Blur Kernel

Luma AI logoLuma AI● MediumFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Luma AI assessment provides the Gaussian-kernel formula, symmetry rule, sigma meaning, and normalization requirement. The practice task matches the report at about 99%.

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 = 3sigma = 1.0return = [[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.

More Luma AI Online Assessment questions

  • Center Crop a Grayscale ImageOA · Seen Jun 2026
  • Impute Missing Values and Normalize ColumnsOA · Seen Jun 2026
  • Minimum Euclidean Distance Between PointsOA · Seen Jun 2026
  • Numerically Stable SoftmaxOA · Seen Jun 2026
  • Rotate a Rectangular Image ClockwiseOA · Seen Jun 2026
  • Triangle Flags from Adjacent ElementsOA · Seen Jun 2026

Similar questions at other companies

  • Rotate a Square Matrix 90 Degrees ClockwiseZipRecruiter · OAZipRecruiter interview questions
  • Survey Table: Group Given an AnswerSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Optimal Central WarehouseGoogle · ONSITE INTERVIEWGoogle interview questions
  • Linear Layer Forward and Backward PassesMeta · ONSITE INTERVIEWMeta interview questions
  • Implement Cross-Entropy LossOpenAI · PHONE SCREENOpenAI interview questions
  • Rotate a Square Grid ClockwiseC3.ai · ONSITE INTERVIEWC3.ai interview questions
  • Linear, Sigmoid and L2 Forward and Backward PassesNVIDIA · PHONE SCREENNVIDIA interview questions
  • Rotate ImageTokopedia · PHONE SCREENTokopedia interview questions
  • Rotate ImageSambaNova Systems · PHONE SCREENSambaNova Systems interview questions
  • Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
All Luma AI interview questionsSee Luma AI hiring insights
Saved
class Solution {
    public double[][] gaussianKernel(int k, double sigma) {
        // Build and normalize the k by k kernel.
    }
}
Checking account…