Wanderlog interview question

Leetcode style questions, easy to do.