Glovo interview question

Two leetcode exercises, easy and medium difficulty