Product of Complex Numbers
Basic Accuracy: 0.0% Submissions: 0 Points: 1

Given two arrays A[] and B[] of real and imaginary part of 5 complex numbers, find the product of these five Complex numbers The array A[] contains the real part and B[] contains the imaginary part. So, if A[0] is 5 and B[0] is 4, the complex numbers is (5 + 4i).


Example 1:

A[] = {1, 2, 3, 4, 5}
B[] = {0, 0, 0, 0, 0}
120 0
We are to multiply the 5 complex numbers
and so (1+0i)*(2+0i)*(3+0i)*(4+0i)*(5+0i).
We can see that answer is 120 + 0i.

Example 2:

A[] = {1, 2, 3, 4, 5}
B[] = {1, 2, 3, 4, 5}
-480 -480
(1+1i)*(2+2i)*(3+3i)*(4+4i)*(5+5i)= -480-480i 


Your Task:
You don't need to read input or print anything. Your task is to complete the function complexProduct() which takes 2 arrays A[] and B[], both of length 5 as input and returns a vector of two integers, the first one being the real part and the second being the imaginary part of the product of these 5 complex Numbers.


Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)


1 <= A[i], B[i] <= 70

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Product of Complex Numbers

Output Window