Apple Interview Question

Asked to complete Leetcode style coderpad questions