Domanda di colloquio di Sunrun

Few algorithm questions from Leetcode website.