You are viewing a single comment's thread. Return to all comments →
Python solution, O(n) runtime, no need to sort
def icecreamParlor(m, arr): test = dict() for i in range(len(arr)): if arr[i] not in test: test[m-arr[i]] = i+1 #dollar match amount is key, 1based index is value else: return sorted([i+1, test[arr[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 →
Python solution, O(n) runtime, no need to sort