Back to problems

Company Role Assignment

Algorithm · Hubspot · Medium

A company stores links connecting companies, contacts, and the roles those contacts hold. Represent every link as three strings: companyId, contactId, and role. You receive two collections: existingAssociations: links that are already stored. newAssociations: links that arrive in one validation batch. Examine the entries in newAssociations from left to right. Apply the following checks in this exact sequence: Association Already Present: Reject the entry when the identical…

Checking your access…