Ad
Code
Diff
  • # Enter solution here
    def get_signal_pattern(building_map):
        result_list = []
        for index_i, i in enumerate(building_map):
            tmp_list = []
            for index_j, j in enumerate(i):
                if j == 0 and index_i == 0:
                    tmp_list.append(1)
                elif j == 0 and index_i != 0 and result_list[index_i-1][index_j] == 1:
                    tmp_list.append(1)
                elif j == 0 and index_i != 0 and result_list[index_i-1][index_j] == 0:
                    tmp_list.append(0)
                else:
                    tmp_list.append(0)
            result_list.append(tmp_list)
        return result_list
    • # Enter solution here
    • def get_signal_pattern(building_map):
    • return []
    • result_list = []
    • for index_i, i in enumerate(building_map):
    • tmp_list = []
    • for index_j, j in enumerate(i):
    • if j == 0 and index_i == 0:
    • tmp_list.append(1)
    • elif j == 0 and index_i != 0 and result_list[index_i-1][index_j] == 1:
    • tmp_list.append(1)
    • elif j == 0 and index_i != 0 and result_list[index_i-1][index_j] == 0:
    • tmp_list.append(0)
    • else:
    • tmp_list.append(0)
    • result_list.append(tmp_list)
    • return result_list