Ad
Code
Diff
  • def get_signal_pattern(building_map):
        inc,outc,blist,l=0,0,[],building_map
        for i in l:
            for j in i:
                if outc==0:
                    if l[outc][inc]==0:
                        l[outc].pop(inc)
                        l[outc].insert(inc,1)
                    else:
                        l[outc].pop(inc)
                        l[outc].insert(inc,0)
                        blist.append(inc)
                else:
                    if inc in blist:
                        if l[outc][inc]==1:
                            blist.append(inc)
                            l[outc].pop(inc)
                            l[outc].insert(inc,0)
                    else:
                        if l[outc][inc]==0:
                            l[outc].pop(inc)
                            l[outc].insert(inc,1)
                        else:
                            blist.append(inc)
                            l[outc].pop(inc)
                            l[outc].insert(inc,0)
                inc+=1
            inc=0
            outc+=1
        return l
    • # Enter solution here
    • def get_signal_pattern(building_map):
    • return []
    • inc,outc,blist,l=0,0,[],building_map
    • for i in l:
    • for j in i:
    • if outc==0:
    • if l[outc][inc]==0:
    • l[outc].pop(inc)
    • l[outc].insert(inc,1)
    • else:
    • l[outc].pop(inc)
    • l[outc].insert(inc,0)
    • blist.append(inc)
    • else:
    • if inc in blist:
    • if l[outc][inc]==1:
    • blist.append(inc)
    • l[outc].pop(inc)
    • l[outc].insert(inc,0)
    • else:
    • if l[outc][inc]==0:
    • l[outc].pop(inc)
    • l[outc].insert(inc,1)
    • else:
    • blist.append(inc)
    • l[outc].pop(inc)
    • l[outc].insert(inc,0)
    • inc+=1
    • inc=0
    • outc+=1
    • return l