• + 0 comments

    Hey there, I happen to have a very simple solution in python. It works but has a time exceeding problem and needs optimization. Anyone who has an idea to optimize the inverted loops?

    `def anotherMinimaxProblem(a):
    # Write your code here
    
    max_lst = []
    min_lst = []
    temp = []
    n = len(a)
    perm = permutations(a)
    for i in perm:
        for j in range(n-1):
            val = i[j] ^ i[j+1]
            temp.append(val)
        max_lst.append(max(temp))
        temp = []
    return min(max_lst)
            `