Normalize Columns in Binomial Matrix Efficiently
GoogleData Scientist · Technical ScreenLast 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.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.