Question d’entretien chez MathWorks

Degree question from leetcode : easy problem