maths.three_sum =============== .. py:module:: maths.three_sum .. autoapi-nested-parse:: https://en.wikipedia.org/wiki/3SUM Functions --------- .. autoapisummary:: maths.three_sum.three_sum Module Contents --------------- .. py:function:: three_sum(nums: list[int]) -> list[list[int]] Find all unique triplets in a sorted array of integers that sum up to zero. Args: nums: A sorted list of integers. Returns: A list of lists containing unique triplets that sum up to zero. >>> three_sum([-1, 0, 1, 2, -1, -4]) [[-1, -1, 2], [-1, 0, 1]] >>> three_sum([1, 2, 3, 4]) []