Oscar Health Interview Question

A medium difficulty questions from leetcode