Meta Interview Question

Two algorithm problems. Write code on a online editor. The problems can be found on LeetCode. One of the problem is the easy level, and the second is medium level.