Wiremind interview question

Medium-difficulty Leet code case study