Windsurf interview question

Leetcode style algorithm question. It was hard.