Ad

A company wants to put a cell tower to the north of a city but is unsure of where buildings will cause interference.

You will be given a 2D array comprised of numbers representing the interference of a building. This value will be a decimal number less than 1 that represents the percentage impact it has on the signal strength.

You may assume that the signal is uniform across the entire northern front of the city.

The first row will have the strength of the initial signal strength.

You are tasked with producing a 2D array that shows where the cell signal reaches comprised of numbers that represent the strength of the cell signal at each location.

With each unobstructed row the signal passes through, it will lose a constant 1 strength.

Should the signal drop below 1, it will be considered 0.

Each calculation should be rounded to 2 decimal points.

As an example, you may be given an input resembling the following (formatted to ease of reading):

building_map = [
  [0.20, 0.00, 0.00, 0.00, 0.00],
  [0.00, 0.00, 0.25, 0.00, 0.00],
  [0.00, 0.50, 0.00, 0.00, 0.00],
  [0.00, 0.00, 0.50, 0.00, 0.00],
  [0.15, 0.00, 0.00, 0.10, 0.00]
],
signal_strength = 4

You should return the following array:

signal_map = [
  [3.20, 4.00, 4.00, 4.00, 4.00],
  [2.20, 3.00, 3.00, 3.00, 3.00],
  [1.20, 1.50, 2.00, 2.00, 2.00],
  [0.00, 0.00, 1.00, 1.00, 1.00],
  [0.00, 0.00, 0.00, 0.00, 0.00]
]
# Enter solution here
def get_signal_pattern(building_map, signal_strength):
    return []

A company wants to put a cell tower to the north of a city but is unsure of where buildings will cause interference.

You will be given a 2D array comprised of 0s and 1s representing no buildings and buildings respectively.

You may assume that the signal is uniform across the entire northern front of the city.

You are tasked with producing a 2D array that shows where the cell signal reaches comprised of 0s and 1s where 0 is no signal and 1 has signal.

For this first iteration, assume that one building stops a signal and the locations of builds also do not have signal.

You may also assume that the signal is otherwise strong enough to reach the southern edge of the city.

As an example, you may be given an input resembling the following:

building_map = [
  [1, 0, 0, 0, 0],
  [0, 0, 1, 0, 0],
  [0, 1, 0, 0, 0],
  [0, 0, 1, 0, 0],
  [1, 0, 0, 1, 0]
]

You should return the following array:

signal_map = [
  [0, 1, 1, 1, 1],
  [0, 1, 0, 1, 1],
  [0, 0, 0, 1, 1],
  [0, 0, 0, 1, 1],
  [0, 0, 0, 0, 1]
]
# Enter solution here
def get_signal_pattern(building_map):
    return []