Organizing Containers of Balls

  • + 0 comments
    def organizingContainers(container):
      dt=set()
      a=[0]*len(container)
      for i in  range(len(container)):
        dt.add(sum(container[i]))
        for j in range(len(container)):
            a[j]+=container[i][j]
      a.sort()
      if set(a)==dt:
        return 'Possible'
      else:
        return 'Impossible