maths.triplet_sum ================= .. py:module:: maths.triplet_sum .. autoapi-nested-parse:: Given an array of integers and another integer target, we are required to find a triplet from the array such that it's sum is equal to the target. Attributes ---------- .. autoapisummary:: maths.triplet_sum.dataset maths.triplet_sum.times Functions --------- .. autoapisummary:: maths.triplet_sum.make_dataset maths.triplet_sum.solution_times maths.triplet_sum.triplet_sum1 maths.triplet_sum.triplet_sum2 Module Contents --------------- .. py:function:: make_dataset() -> tuple[list[int], int] .. py:function:: solution_times() -> tuple[float, float] .. py:function:: triplet_sum1(arr: list[int], target: int) -> tuple[int, Ellipsis] Returns a triplet in the array with sum equal to target, else (0, 0, 0). >>> triplet_sum1([13, 29, 7, 23, 5], 35) (5, 7, 23) >>> triplet_sum1([37, 9, 19, 50, 44], 65) (9, 19, 37) >>> arr = [6, 47, 27, 1, 15] >>> target = 11 >>> triplet_sum1(arr, target) (0, 0, 0) .. py:function:: triplet_sum2(arr: list[int], target: int) -> tuple[int, int, int] Returns a triplet in the array with sum equal to target, else (0, 0, 0). >>> triplet_sum2([13, 29, 7, 23, 5], 35) (5, 7, 23) >>> triplet_sum2([37, 9, 19, 50, 44], 65) (9, 19, 37) >>> arr = [6, 47, 27, 1, 15] >>> target = 11 >>> triplet_sum2(arr, target) (0, 0, 0) .. py:data:: dataset .. py:data:: times