Pregunta de entrevista de MathWorks

Explaining your code from the HackerRank challenge, analyzing runtime