def build(self, idx, n, cur, ret):
        if idx == n/2:
            if n % 2 != 0:
                for m in self.middle:
                    if m != "0" or idx != 0:
                        temp = list(cur)
                        temp.append(m)
                        for i in xrange(idx-1, -1, -1):
                            temp.append(self.map[temp[i]])
                        ret.append("".join(temp))
            else:
                temp = list(cur)
                for i in xrange(idx-1, -1, -1):
                    temp.append(self.map[temp[i]])
                    ret.append("".join(temp))

            return

        for k in self.map.keys():
            if k != "0" or idx != 0:
                cur.append(k)
                self.build(idx+1, n, cur, ret)
                cur.pop()
dataset/ETHPy150Open algorhythms/LeetCode/247 Strobogrammatic Number II.py/SolutionOutputLimitExceeded.build/original