Pregunta de entrevista de Wix

a couple of leetcode problems involving matrixes and math