Solve Matrix Equations (Also for AI/ML Interns :)
Updated
Problem statement
Write a Python Program using SciPy that solves the equation X = A*B*C, given X, B, and C, as input. In the equation, X is a scalar, A is the unknown 1x2 vector, B is a 2x2 matrix, and C is a 2x1 vector. The two elements of A have the relationship A[1] = 1 - A[0]. Find the value of vector A.
Function
findA(X: float, B: float[][], C: float[][]) → float[]
Complete the function findA in the editor below.
findA has the following parameter(s):
float X: the value of X.float B[2][2]: the matrix B.float C[2][1]: the vector C.
Returns
float[2]: an array containing the two values A[0] and A[1].
Examples
Example 1
X = 0.35B = [[3, -1], [-2, 3]]C = [[0.2], [0.8]]return = [0.75, 0.25]
After solving the equation X = A*B*C under the constraints A[1] = 1 - A[0], the value of the vector A = [[0.75, 0.25]].
The values of A should be rounded to two decimal places.
Constraints
Bhas exactly 2 rows and 2 columns.Chas exactly 2 rows and 1 column.- The two entries of
B * Care different, so the equation has a unique solution underA[1] = 1 - A[0]. - Round both returned values to two decimal places.
More Snowflake interview questions
- Minimum StackPHONE SCREEN · Seen Nov 2026
- Design In-Memory File SystemPHONE SCREEN · Seen Nov 2026
- Merge Two Binary TreesPHONE SCREEN · Seen Nov 2026
- Connect Four from the Last MovePHONE SCREEN · Seen Nov 2026
- Minimum Edits to a Perfect Binary TreePHONE SCREEN · Seen Nov 2026
- Parallel Courses IIIONSITE INTERVIEW · Seen Nov 2026
- Safest Shortest Path Through a GridOA · Seen Nov 2026
- Configurable Per-Client Token BucketsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
- LFU CacheOA · ONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
- Costliest ChocolateRippling · OARippling interview questions
- Distinct Chapters Missed During a Cyclic AbsenceVisa · OAVisa interview questions
- Count Palindromic Base RepresentationsSEDEMAC · OA
- Reduce a Number to One DigitAccenture · OAAccenture interview questions
- Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
- Calculate the Half SpreadMillennium · OAMillennium interview questions
- Plus Mult ArrayIBM · OAIBM interview questions
- Product Minus Sum of DigitsTikTok · OATikTok interview questions