Uber Interview Question

Typical leetcode-style question solvable with an array