<commit_before>"""
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.

Note:

The solution set must not contain duplicate triplets.
"""

from typing import Dict, List

class Solution:
    def threeSum(self, nums: List[int]) -> List[List[int]]:
        results = []
        length = len(nums)
        found = {}, {}
        for i, a in enumerate(nums[:-2]):
            for j in range(i+1, length-1):
                b = nums[j]
                for k in range(j+1, length):
                    c = nums[k]
                    print(a, i, b, j, c, k)
                    if (a + b + c) == 0:
                        res = [a, b, c]
                        key = "".join(sorted(res))
                        if not key in found:
                            results.append(res)
                            found[key] = True
        return results


def alreadyFound(a, b, c: int, products, sums: Dict[int, bool]):
    return (a * b * c in products and a + b + c in sums)<commit_msg>Tidy up<commit_after>"""
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.

Note:

The solution set must not contain duplicate triplets.
"""

from typing import Dict, List

class Solution:
    def threeSum(self, nums: List[int]) -> List[List[int]]:
        results = []
        length = len(nums)
        found = {}
        for i, a in enumerate(nums[:-2]):
            for j in range(i+1, length-1):
                b = nums[j]
                for k in range(j+1, length):
                    c = nums[k]
                    if (a + b + c) == 0:
                        res = [a, b, c]
                        key = "".join([str(x) for x in sorted(res)])
                        if not key in found:
                            results.append(res)
                            found[key] = True
        return results
{'fraction_non_alphanumeric': 0.11000991080277503, 'fraction_numerical': 0.005946481665014866, 'mean_word_length': 1.4266826923076923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5737794', 'n_tokens_mistral': 617, 'n_tokens_neox': 584, 'n_words': 231}