Pregunta de entrevista de MathWorks

Leetcode 2 questions, Low level system design