Clover Interview Question

I was asked to solve a LeetCode-style problem on a whiteboard during the interview.