You are viewing a single comment's thread. Return to all comments →
Not sure if it's a better solution. This is the logic I used.
def icecreamParlor(m, arr): combos=list(combinations(arr,2)) indexes=[] for i in range(len(combos)): if combos[i][0]+combos[i][1]==m: if arr.index(combos[i][0])!=arr.index(combos[i][1]): indexes.append([arr.index(combos[i][0])+1,arr.index(combos[i][1])+1]) else: indexes.append([arr.index(combos[i][0])+1,arr.index(combos[i][1],arr.index(combos[i][0])+1)+1]) indexes.sort() for i in range(len(indexes)): return indexes[i]
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Not sure if it's a better solution. This is the logic I used.