Roblox interview question

Leetcode Medium Question, Linear algebra, probability.