Why my submition get Output Limit Exceeded


  • 0
    G

    class Solution:
    # @param num, a list of integer
    # @return a list of lists of integers
    list = []
    def create(self, array, num):
    size = len(num)
    if size == 1:
    self.list.append(array + [num[0]])
    else:
    for ele in num:
    temp = []
    for e in num:
    temp.append(e)
    temp.remove(ele)
    self.create(array + [ele], temp)
    return self.list
    def permute(self, num):
    if len(num) == 0:
    return []
    if len(num) == 1:
    return [[num[0]]]
    s = self.create([], num)
    return s


  • 0
    H

    format your code first.... it's just not readable


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.