Layer6 AI interview question

Leetcode, implement a class with several functions.