MathWorks Interview Question

HackerRank had 3 questions: 2 using data structures and algorithms and one that was more mathematical.