Google Interview Question

Hard question related to coordinates mostly related to competitive programming.