''' Given an array of three arrays of triples of integers, return the missing triple of integers to make them all add up to 0 coordinatewise Example 1 Input: [[1, 2, 3], [9, -2, 8], [17, 2, 50]] Output: [-27, -2, -61] ''' from typing import List class Solution(object): def solve(self, nums:List[List[int]]) -> List[int]: print(f"nums: {nums}") # Initialize the result triple result = [0, 0, 0] # Iterate through each array for arr in nums: # Add the values coordinatewise for i in range(3): result[i] += arr[i] # The missing triple is the negative of twice the result return [-2*x for x in result] arrays = [[1,-2, 3], [9, -2, 8], [27, 2, 50]] solution = Solution() print(solution.solve(arrays))