def threeSum_TLE(self, num):

        # hash
        reverse_map = {}
        for ind, val in enumerate(num):
            if val not in reverse_map:
                reverse_map[val] = [ind]
            else:
                reverse_map[val].append(ind)

        result = {}
        for i in xrange(len(num)):
            for j in xrange(i, len(num)):
                target = 0-num[i]-num[j]
                if target not in reverse_map:
                    continue
                for index in reverse_map[target]:
                    if index != i and index != j:
                        lst = sorted([num[i], num[j], target])
                        lst = tuple(lst)
                        result[lst] = 1  # hash
                        break

        return result.keys()
Tests ordered inserts
dataset/ETHPy150Open algorhythms/LeetCode/014 3Sum.py/Solution.threeSum_TLE--crossover with--dataset/ETHPy150Open vmalloc/mongomock/tests/test__collection_api.py/CollectionAPITest.test__ordered_insert_find