Uber Interview Question

A top difficulty leetcode question