Google | Phone screen | Water supply
Anonymous User
7607

Question 1:
Given software name (string[] array) and it's corresponding version number (int[] array), design an efficient algorithm to find the highest version based on any provided software name.

For example: you may receive, ["iOS", "Google Doc", "iOS", "Windows", "Google Doc"] and its corresponding versions are [11, 3, 5, 3, 6]. If you search for "iOS" the output must be 11 not 5.

Question 2:
Let's say you're an environmental engineer trying to assist in laying out infrastructure in some village. The village has N houses, each which needs a water supply. A house can receive water if:

  • A well is built there
  • There is some path of pipes to a house with a water well

You work with a contractor and figure out

  • The cost to build a well at house (well_cost[i])
  • The cost of the pipe to connect house[i] and house[j] (pipe_cost[i][j])

What's the cheapest way to make sure every house in the village is connected to a water supply?

Comments (9)