
Asked in Jaguar Land Rover
Complex Number Multiplication
Calculate the product of two complex numbers represented as strings in the form “A+Bi”. Here, ‘A’ represents the real part, and ‘B’ represents the imaginary part.
Explanation
You will be given two complex numbers as strings, 'NUM1' and 'NUM2'. Your task is to find their product and return it in the same string format "A+Bi", where ‘A’ is the real part and ‘B’ is the imaginary part of the result.
Input:
The first line contains an integer ‘T’ representing the number of test cases. Each test case consists of two lines:
- The first line contains the string representing the first complex number 'NUM1'.
- The second line contains the string representing the second complex number 'NUM2'.
Output:
For each test case, return the result of the complex multiplication as a string in the form "A+Bi".
Example:
Input:
T = 1
NUM1 = "1+1i"
NUM2 = "1+1i"
Output:
-0+2i
Constraints:
1 ≤ T ≤ 105
-107 ≤ A, B ≤ 107
- Time Limit: 1 sec
Note:
Printing is not required; focus on implementing the function that processes the logic and returns the result.

AnswerBot
4mo
Calculate the product of two complex numbers represented as strings in the form 'A+Bi'.
Parse the input strings to extract real and imaginary parts of both complex numbers
Perform multiplication of the ...read more
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Jaguar Land Rover
Q. SELL ABD BUY 1 array question(easy level)
Q. Beautiful String Verification Given a non-empty string inputString, determine if...read more
Q. What are the page replacement algorithms in Operating Systems?
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Jaguar Land Rover Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

