Leetcode 4sum problem using hashmaps
Use enumerate rather than range(len(...)) + __getitem__. It is both faster and more readable.
To limit items of the second iteration to be "after the current item" you can use itertools.combinations.
To avoid the need to check for the special case of "is the item already in the dictionary?", use a collections.defaultdict.
You could use a set rather than a list to store the final results and remove yourself the need to check for duplicates
-key + target is better written as target - key




import itertools
from collections import defaultdict


def four_sum(array, target):
    seen = defaultdict(set)
    for (i, first), (j, second) in itertools.combinations(enumerate(array), 2):
        seen[first + second].add((i, j))

    result = set()
    for key, first_indices in seen.items():
        second_indices = seen.get(target - key, set())
        for p, q in second_indices:
            for i, j in first_indices:
                # Not reusing the same number twice
                if not ({i, j} &amp; {p, q}):
                    indices = tuple(sorted(array[x] for x in (i, j, p, q)))
                    result.add(indices)
    return result