BlackRock | Technical 1st Round Interview | Number of Bids

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-05-23Added By Anonymous
Source: Link
Location: NYC Position: Associate, Full Stack Engineer Time: 45 Mins, interviewer gave me 60 mins Can't find the specific question, but it was a simple hashmap question in Hackerrank that went something like this: Given a a target number of porjects you want to accomplish, and two lists that map the bids given to that project (E.g id #0 has a bid for 100), id#1 has a bid for 100, #id 0 has a bid for 15, id # 1 had a bid for 14, id #1 0 has a bid for 500), Find the cheapest bid for each project targetNumberOfProjects = 2 projectId = [0,1,0,1,0] bid = [100, 100, 15, 14, 500] Answer = 15 + 14 = 29 In the case you cannot accomplish a project, return -1 (sample case below) targetNumberOfProjects = 2 projectId = [1,1 ] bid = [100, 50] Answer = -1 Explanation: since we are missing a bid for a project with id #0, we cannot accomplish our targetNumbOfProjects, which needs a project with id # 0 AND id #1 To clarify, array projectId and bid will always have the same length
Comments