Amazon Interview Question

Two classical Leetcode Medium questions. Two design problems.