Papaya Global Interview Question

Some random leet code quesiton