Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

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:**

Input:A[] ={1, 2, 3, 4, 5}B[] ={0, 0, 0, 0, 0}Output:120 0Explanation: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:**

Input:A[] ={1, 2, 3, 4, 5}B[] ={1, 2, 3, 4, 5}Output:-480 -480Explanation:(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)

**Constraints:**

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

Login 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?

Yes
Product of Complex Numbers

...