Uber Interview Question

OA about the leetcode med to hard