Ridgeline interview question

Leetcode easy question I say.