Given A, B and N. Find x and y that satisfies equation Ax + By = N. If there's no solution print -1 in place of both x and y. Note: There are Multiple solutions possible. Find the solution where x is minimum. x and y should both be non-negative.
Input:A = 2, B = 3, N = 7Output:2 1Explanation:2*2 + 3*1 = 7.
Input:A = 4, B = 2, N = 7Output:-1 -1Explanation:There's no solution for x and y the equation.
You don't need to read input or print anything. Your task is to complete the function findXandY() which takes 3 Integers A,B and N as input and returns a list of 2 integers with the first integer x and the second being y.
Expected Time Complexity: O(N) Expected Auxiliary Space: O(1)