def numSquares_bfs(self, n):
        q = [0]
        visited = [False for _ in xrange(n+1)]

        level = 0
        while q:
            level += 1
            l = len(q)
            for i in xrange(l):
                for j in xrange(1, int(math.sqrt(n))+1):
                    nxt = q[i]+j*j
                    if nxt <= n and visited[nxt]:
                        continue
                    elif nxt < n:
                        visited[nxt] = True
                        q.append(nxt)
                    elif nxt == n:
                        return level
                    else:
                        break
            q = q[l:]

        return None
Returns number of VMs given a server and a slice.
dataset/ETHPy150Open algorhythms/LeetCode/279 Perfect Squares.py/Solution.numSquares_bfs--crossover with--dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/utils/templatetags/servers.py/number_vms_inside_server_for_slice