Zillow Interview Question

Hard Leetcode problem regarding arrays