Workday Interview Question

2 mediums leetcode questions in around 1 hour