Sumo Logic interview question

Two leetcode easy style questions