Domanda di colloquio di HubSpot

How would you reduce the O(n) complexity?