IXL Learning Interview Question

One leetcode medium question with a bit of OOP