Company: Tekion_4aug
Difficulty: medium
Find Minimum Sum for Linear Equation Problem Description For a linear equation of the form a * x + b * y = z where a >= 0 and b >= 0 , the minimum sum solution is the minimum possible value of a + b where a * arr[i] + b * arr[j] = z for some indices i and j (possibly i = j ). Given an array arr , a query array, and an integer k , for each query value z , find the minimum sum solution. If the minimum sum a + b is less than or equal to k , include it in the answer array; otherwise, include -1 . Complete the function getMinSum in the editor with the following parameters: int arr[n]: the input array int query[q]: the queries int k: the maximum allowed sum of a and b Returns: int[q]: the answers to the queries Examples Example 1: Input: n = 5 arr = [1, 2, 3, 6, 67] q = 5 query = [1, 4, 30, 7, 88] k = 5 For each query: z = 1: a = 1, b = 0, a + b = 1 (1 * arr[0] + 0 * arr[0] = 1 * 1 + 0 * 1 = 1) z = 4: a = 1, b = 1, a + b = 2 (1 * arr[1] + 1 * arr[1] = 1 * 2 + 1 * 2 = 4) z = 30: a = 5, b = 0,