Whatnot interview question

Coding question on internal problem