Microsoft Interview Question

Two leet code questions to finish in 1 hour.