We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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)
`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Yet Another Minimax Problem
You are viewing a single comment's thread. Return to all comments →