TikTok Interview Question

LC-style question: Construct product matrix