Katkat

Normalize Columns in Binomial Matrix Efficiently

GoogleData Scientist · Technical Screen

Last updated

This question evaluates proficiency in matrix manipulation, handling of binomial random samples, column normalization, and algorithmic efficiency for processing large numerical arrays.

Scenario

Write code that creates a 100×100 matrix of Binomial(1, 0. 5) samples and normalizes each column so it sums to 1.

Question

Provide an efficient algorithm (language of your choice) to perform the above task in O(n²) time.

Hints

Vectorized NumPy operations beat nested loops.